Skip to content

Commit 3f0d91f

Browse files
committed
fix ValueTest/specialFloats test failure when fp:fast on msvc
1 parent 0221111 commit 3f0d91f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib_json/json_writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
149149

150150
} else {
151151
// IEEE standard states that NaN values will not compare to themselves
152-
if (value != value) {
152+
if (isnan(value)) {
153153
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null");
154154
} else if (value < 0) {
155155
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999");

0 commit comments

Comments
 (0)