Skip to content

Commit

Permalink
trees.nim: compare floating points by their bitpatterns because NaN c…
Browse files Browse the repository at this point in the history
…omparisions are always false (WORST design in the history of computing!)
  • Loading branch information
Araq committed Mar 23, 2020
1 parent 913bc95 commit 28a755d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/trees.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 28a755d

Please sign in to comment.