From 3b7ef2288f60bc5c355ad9aeaa127431ec3aee7b Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Mon, 14 Dec 2009 01:38:05 +0100 Subject: floating point checks --- tests/99bottles.nim | 1 + tests/tfloat1.nim | 8 ++++++++ tests/tfloat2.nim | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100755 tests/99bottles.nim create mode 100755 tests/tfloat1.nim create mode 100755 tests/tfloat2.nim (limited to 'tests') diff --git a/tests/99bottles.nim b/tests/99bottles.nim new file mode 100755 index 000000000..14904ac0f --- /dev/null +++ b/tests/99bottles.nim @@ -0,0 +1 @@ +# Test if the compiler detects invalid module names diff --git a/tests/tfloat1.nim b/tests/tfloat1.nim new file mode 100755 index 000000000..89911dd61 --- /dev/null +++ b/tests/tfloat1.nim @@ -0,0 +1,8 @@ +# Test new floating point exceptions + +{.floatChecks: on.} + +var x = 0.8 +var y = 0.0 + +echo x / y #OUT Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow] diff --git a/tests/tfloat2.nim b/tests/tfloat2.nim new file mode 100755 index 000000000..92421d446 --- /dev/null +++ b/tests/tfloat2.nim @@ -0,0 +1,8 @@ +# Test new floating point exceptions + +{.floatChecks: on.} + +var x = 0.0 +var y = 0.0 + +echo x / y #OUT Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp] -- cgit 1.4.1-2-gfad0