diff options
author | Araq <rumpf_a@web.de> | 2020-03-23 12:03:49 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2020-03-23 12:05:59 +0100 |
commit | 28a755dc80a4a528e7f4820213f6ef0c779495ab (patch) | |
tree | 59c1275c74580738879468e5d202e12926fb2d07 /compiler | |
parent | 913bc95964458d3eb2fc4d8a108031e6b9398da5 (diff) | |
download | Nim-28a755dc80a4a528e7f4820213f6ef0c779495ab.tar.gz |
trees.nim: compare floating points by their bitpatterns because NaN comparisions are always false (WORST design in the history of computing!)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/trees.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/trees.nim b/compiler/trees.nim index 3b715053e..8c89ccca9 100644 --- a/compiler/trees.nim +++ b/compiler/trees.nim @@ -39,7 +39,7 @@ proc exprStructuralEquivalent*(a, b: PNode; strictSymEquality=false): 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 nkCommentStmt: result = a.comment == b.comment of nkEmpty, nkNilLit, nkType: result = true |