]> granicus.if.org Git - jq/commitdiff
Accept only bitwise identical NaN values in jv_identical (fix #978) 983/head
authorDavid Tolnay <dtolnay@gmail.com>
Mon, 12 Oct 2015 06:08:43 +0000 (23:08 -0700)
committerDavid Tolnay <dtolnay@gmail.com>
Tue, 13 Oct 2015 03:47:22 +0000 (20:47 -0700)
src/jv.c

index 9c6a868c1acda473b9d2b2e7ecfd6aab9927bea6..e064baf572c6b7eba95357cdeece85c72ec24562 100644 (file)
--- a/src/jv.c
+++ b/src/jv.c
@@ -1303,7 +1303,7 @@ int jv_identical(jv a, jv b) {
       r = a.u.ptr == b.u.ptr;
       break;
     case JV_KIND_NUMBER:
-      r = a.u.number == b.u.number || (isnan(a.u.number) && isnan(b.u.number));
+      r = memcmp(&a.u.number, &b.u.number, sizeof(a.u.number)) == 0;
       break;
     default:
       r = 1;