Support NaN in path expressions (fix #962)

This commit is contained in:
David Tolnay committed 2015-09-24 10:33:34 -07:00
1 parent c4524da3e0
commit 4490d9d1f6
2 files changed
+6 -1

No files matched your search

+2 -1
View File
@@ -6,6 +6,7 @@
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <math.h>
#include "jv_alloc.h"
#include "jv.h"
@@ -1302,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;
r = a.u.number == b.u.number || (isnan(a.u.number) && isnan(b.u.number));
break;
default:
r = 1;
+4
View File
@@ -851,6 +851,10 @@ try (def x: reverse; x=10) catch .
[0,1,2]
"Invalid path expression with result [2,1,0]"
.[] = 1
[1,null,Infinity,-Infinity,NaN,-NaN]
[1,1,1,1,1,1]
#
# Conditionals
#