From: Miroslav Lichvar Date: Mon, 18 May 2015 13:50:07 +0000 (+0200) Subject: util: handle NaN in UTI_FloatHostToNetwork() X-Git-Tag: 2.1-pre1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cde3a003ea129b0f65318d0d5de27fd922688aba;p=thirdparty%2Fchrony.git util: handle NaN in UTI_FloatHostToNetwork() --- diff --git a/util.c b/util.c index 8141e584..db59c60d 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; }