Skip to content

Commit bcccb74

Browse files
committed
trees.nim: compare floating points by their bitpatterns because NaN comparisions are always false (WORST design in the history of computing!)
1 parent ee440df commit bcccb74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/trees.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ proc sameTree*(a, b: PNode): bool =
6464
result = a.sym.name.id == b.sym.name.id
6565
of nkIdent: result = a.ident.id == b.ident.id
6666
of nkCharLit..nkUInt64Lit: result = a.intVal == b.intVal
67-
of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal
67+
of nkFloatLit..nkFloat64Lit: result = cast[uint64](a.floatVal) == cast[uint64](b.floatVal)
6868
of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal
6969
of nkEmpty, nkNilLit, nkType: result = true
7070
else:

0 commit comments

Comments
 (0)