From 3f0d91f08a048a799e3eead16c10bd21977da53a Mon Sep 17 00:00:00 2001 From: fo40225 Date: Sat, 5 May 2018 14:38:53 +0800 Subject: [PATCH] fix ValueTest/specialFloats test failure when fp:fast on msvc --- src/lib_json/json_writer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index be03a66..3b22ee8 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -149,7 +149,7 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p } else { // IEEE standard states that NaN values will not compare to themselves - if (value != value) { + if (isnan(value)) { len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null"); } else if (value < 0) { len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999");