summary refs log tree commit diff stats
path: root/tests/stdlib/tmath.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/tmath.nim')
-rw-r--r--tests/stdlib/tmath.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/stdlib/tmath.nim b/tests/stdlib/tmath.nim
index 16c274032..a4b493b93 100644
--- a/tests/stdlib/tmath.nim
+++ b/tests/stdlib/tmath.nim
@@ -357,5 +357,18 @@ template main =
         doAssert copySign(10.0, -NaN) == 10.0
         doAssert copySign(1.0, copySign(NaN, -1.0)) == -1.0 # fails in VM
 
+  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()