summary refs log tree commit diff stats
path: root/tests/float/tfloatnan.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float/tfloatnan.nim')
-rw-r--r--tests/float/tfloatnan.nim15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/float/tfloatnan.nim b/tests/float/tfloatnan.nim
index 8f384c3d9..9e3dd94f6 100644
--- a/tests/float/tfloatnan.nim
+++ b/tests/float/tfloatnan.nim
@@ -15,7 +15,7 @@ echo "Nim: ", f32, " (float)"
 let f64: float64 = NaN
 echo "Nim: ", f64, " (double)"
 
-block: # issue #10305
+block: # bug #10305
   # with `-O3 -ffast-math`, generated C/C++ code is not nan compliant
   # user can pass `--passC:-ffast-math` if he doesn't care.
   proc fun() =
@@ -42,3 +42,16 @@ block: # issue #10305
   fun()
   fun2(0)
 
+template main() =
+  # xxx move all tests under here
+  block: # bug #16469
+    let a1 = 0.0
+    let a2 = -0.0
+    let a3 = 1.0 / a1
+    let a4 = 1.0 / a2
+    doAssert a3 == Inf
+    doAssert a4 == -Inf
+    doAssert $(a1, a2, a3, a4) == "(0.0, -0.0, inf, -inf)"
+
+static: main()
+main()