util: handle NaN in UTI_FloatHostToNetwork()

This commit is contained in:
Miroslav Lichvar 2015-05-18 15:50:07 +02:00
parent 2c35f56612
commit cde3a003ea

4
util.c
View file

@ -707,7 +707,11 @@ UTI_FloatHostToNetwork(double x)
if (x < 0.0) { if (x < 0.0) {
x = -x; x = -x;
neg = 1; neg = 1;
} else if (x >= 0.0) {
neg = 0;
} else { } else {
/* Save NaN as zero */
x = 0.0;
neg = 0; neg = 0;
} }