diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 96f35c3c0c..707fbbf541 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -735,7 +735,7 @@ proc nimParseBiggestFloat(s: openarray[char], number: var BiggestFloat): int {.c if s[i+1] == 'A' or s[i+1] == 'a': if s[i+2] == 'N' or s[i+2] == 'n': if s[i+3] notin IdentChars: - number = NaN + number = if sign: -NaN else: NaN return i+3 return 0 if s[i] == 'I' or s[i] == 'i': diff --git a/lib/system/strmantle.nim b/lib/system/strmantle.nim index 92a8653f2a..793c3c4a35 100644 --- a/lib/system/strmantle.nim +++ b/lib/system/strmantle.nim @@ -117,7 +117,7 @@ proc nimParseBiggestFloat(s: openArray[char], number: var BiggestFloat, if s[i+1] == 'A' or s[i+1] == 'a': if s[i+2] == 'N' or s[i+2] == 'n': if i+3 >= s.len or s[i+3] notin IdentChars: - number = NaN + number = if sign < 0: -NaN else: NaN return i+3 return 0