mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
* fix #16494 * fix * fix * fix * fix * fix * fix performance * add comments * improve performance * Update lib/system.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/system.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/stdlib/tmath_misc.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/stdlib/tmath_misc.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
25 lines
489 B
Nim
25 lines
489 B
Nim
discard """
|
|
targets: "c js"
|
|
"""
|
|
|
|
# TODO merge this to tmath.nim once tmath.nim supports js target
|
|
|
|
import math
|
|
|
|
proc main() =
|
|
block:
|
|
doAssert 1.0 / abs(-0.0) == Inf
|
|
doAssert 1.0 / abs(0.0) == Inf
|
|
doAssert -1.0 / abs(-0.0) == -Inf
|
|
doAssert -1.0 / abs(0.0) == -Inf
|
|
doAssert abs(0.0) == 0.0
|
|
doAssert abs(0.0'f32) == 0.0'f32
|
|
|
|
doAssert abs(Inf) == Inf
|
|
doAssert abs(-Inf) == Inf
|
|
doAssert abs(NaN).isNaN
|
|
doAssert abs(-NaN).isNaN
|
|
|
|
static: main()
|
|
main()
|