From 9d4a1f95544c6c7c58829384cf8045e3803faab0 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Fri, 1 Jan 2021 03:59:19 -0600 Subject: fix #16494 (#16513) * fix #16494 * fix * fix * fix * fix * fix * fix performance * add comments * improve performance * Update lib/system.nim Co-authored-by: Timothee Cour * Update lib/system.nim Co-authored-by: Timothee Cour * Update tests/stdlib/tmath_misc.nim Co-authored-by: Timothee Cour * Update tests/stdlib/tmath_misc.nim Co-authored-by: Timothee Cour Co-authored-by: Timothee Cour --- tests/stdlib/tmath_misc.nim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/stdlib/tmath_misc.nim (limited to 'tests/stdlib/tmath_misc.nim') diff --git a/tests/stdlib/tmath_misc.nim b/tests/stdlib/tmath_misc.nim new file mode 100644 index 000000000..978e3e94d --- /dev/null +++ b/tests/stdlib/tmath_misc.nim @@ -0,0 +1,24 @@ +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() -- cgit 1.4.1-2-gfad0