fix printing negative zero in JS backend (#16505)
This commit is contained in:
parent
732419ae90
commit
89a2390f8b
2 changed files with 33 additions and 1 deletions
30
tests/misc/tnegativezero.nim
Normal file
30
tests/misc/tnegativezero.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
targets: "c cpp js"
|
||||
"""
|
||||
|
||||
proc main()=
|
||||
block:
|
||||
let a = -0.0
|
||||
doAssert $a == "-0.0"
|
||||
doAssert $(-0.0) == "-0.0"
|
||||
|
||||
block:
|
||||
let a = 0.0
|
||||
when nimvm: discard ## TODO VM print wrong -0.0
|
||||
else:
|
||||
doAssert $a == "0.0"
|
||||
doAssert $(0.0) == "0.0"
|
||||
|
||||
block:
|
||||
let b = -0
|
||||
doAssert $b == "0"
|
||||
doAssert $(-0) == "0"
|
||||
|
||||
block:
|
||||
let b = 0
|
||||
doAssert $b == "0"
|
||||
doAssert $(0) == "0"
|
||||
|
||||
|
||||
static: main()
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue