summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2021-01-05 15:52:24 +0100
committerGitHub <noreply@github.com>2021-01-05 15:52:24 +0100
commit9f1dd5c00f3ef5fdf221732bc2a70553b21426e5 (patch)
treed0ff18288a2c76b33be5d6c60c23ff878cfeef81 /tests
parentb2a53795dcfa96445e27eaea2147d2596a8e4994 (diff)
downloadNim-9f1dd5c00f3ef5fdf221732bc2a70553b21426e5.tar.gz
Make tmath test more strict (#16593)
Don't use approximate equality when comparing
numbers that are representable with perfect precision.
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tmath.nim26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/stdlib/tmath.nim b/tests/stdlib/tmath.nim
index a4b493b93..fbc6b80ad 100644
--- a/tests/stdlib/tmath.nim
+++ b/tests/stdlib/tmath.nim
@@ -170,19 +170,19 @@ block:
 
     block: # round() tests
       # Round to 0 decimal places
-      doAssert round(54.652) ==~ 55.0
-      doAssert round(54.352) ==~ 54.0
-      doAssert round(-54.652) ==~ -55.0
-      doAssert round(-54.352) ==~ -54.0
-      doAssert round(0.0) ==~ 0.0
+      doAssert round(54.652) == 55.0
+      doAssert round(54.352) == 54.0
+      doAssert round(-54.652) == -55.0
+      doAssert round(-54.352) == -54.0
+      doAssert round(0.0) == 0.0
 
     block: # splitDecimal() tests
-      doAssert splitDecimal(54.674).intpart ==~ 54.0
+      doAssert splitDecimal(54.674).intpart == 54.0
       doAssert splitDecimal(54.674).floatpart ==~ 0.674
-      doAssert splitDecimal(-693.4356).intpart ==~ -693.0
+      doAssert splitDecimal(-693.4356).intpart == -693.0
       doAssert splitDecimal(-693.4356).floatpart ==~ -0.4356
-      doAssert splitDecimal(0.0).intpart ==~ 0.0
-      doAssert splitDecimal(0.0).floatpart ==~ 0.0
+      doAssert splitDecimal(0.0).intpart == 0.0
+      doAssert splitDecimal(0.0).floatpart == 0.0
 
     block: # trunc tests for vcc
       doAssert(trunc(-1.1) == -1)
@@ -257,8 +257,8 @@ block:
       doAssert floorDiv(-8, -3) == 2
       doAssert floorMod(-8, -3) == -2
 
-      doAssert floorMod(8.0, -3.0) ==~ -1.0
-      doAssert floorMod(-8.5, 3.0) ==~ 0.5
+      doAssert floorMod(8.0, -3.0) == -1.0
+      doAssert floorMod(-8.5, 3.0) == 0.5
 
     block: # euclDiv/euclMod
       doAssert euclDiv(8, 3) == 2
@@ -273,8 +273,8 @@ block:
       doAssert euclDiv(-8, -3) == 3
       doAssert euclMod(-8, -3) == 1
 
-      doAssert euclMod(8.0, -3.0) ==~ 2.0
-      doAssert euclMod(-8.5, 3.0) ==~ 0.5
+      doAssert euclMod(8.0, -3.0) == 2.0
+      doAssert euclMod(-8.5, 3.0) == 0.5
 
       doAssert euclDiv(9, 3) == 3
       doAssert euclMod(9, 3) == 0