fix negative nan (#16628)

This commit is contained in:
flywind 2021-01-11 04:39:38 -06:00 • committed by GitHub
commit be6e8916fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 5 deletions

View file

@ -2485,7 +2485,10 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
let f = n.floatVal
case classify(f)
of fcNan:
r.res = rope"NaN"
if signbit(f):
r.res = rope"-NaN"
else:
r.res = rope"NaN"
of fcNegZero:
r.res = rope"-0.0"
of fcZero: