diff --git a/util.c b/util.c index 8141e58..db59c60 100644 --- a/util.c +++ b/util.c @@ -707,7 +707,11 @@ UTI_FloatHostToNetwork(double x) if (x < 0.0) { x = -x; neg = 1; + } else if (x >= 0.0) { + neg = 0; } else { + /* Save NaN as zero */ + x = 0.0; neg = 0; }