summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2020-03-23 12:06:33 +0100
committerAraq <rumpf_a@web.de>2020-03-23 12:06:33 +0100
commitbcccb74429c6bd5a9ce48ae8854c38f1275cf228 (patch)
treef79b869dd10773a77bc261b504d8d3db8be66af9
parentee440df02dfae8408d8129faac3a963c5624901d (diff)
downloadNim-bcccb74429c6bd5a9ce48ae8854c38f1275cf228.tar.gz
trees.nim: compare floating points by their bitpatterns because NaN comparisions are always false (WORST design in the history of computing!)
-rw-r--r--compiler/trees.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/trees.nim b/compiler/trees.nim
index 8c89ccca9..cd26b2b4f 100644
--- a/compiler/trees.nim
+++ b/compiler/trees.nim
@@ -64,7 +64,7 @@ proc sameTree*(a, b: PNode): bool =
       result = a.sym.name.id == b.sym.name.id
     of nkIdent: result = a.ident.id == b.ident.id
     of nkCharLit..nkUInt64Lit: result = a.intVal == b.intVal
-    of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal
+    of nkFloatLit..nkFloat64Lit: result = cast[uint64](a.floatVal) == cast[uint64](b.floatVal)
     of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal
     of nkEmpty, nkNilLit, nkType: result = true
     else: