close #18009 parseJson JInt vs JFloat; preserve -0.0 as JFloat to distinguish from 0.0 (#18067)

This commit is contained in:
Timothee Cour 2021-05-23 14:06:14 -07:00 • committed by GitHub
commit d217888e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -938,7 +938,7 @@ when defined(js):
of "[object Array]": return JArray
of "[object Object]": return JObject
of "[object Number]":
if isInteger(x):
if isInteger(x) and 1.0 / cast[float](x) != -Inf: # preserve -0.0 as float
if isSafeInteger(x):
return JInt
else: