[expr] numeric equality operator Uses string equality if either of the arguments cannot be interpreted as numeric, but if you actually want [string equal]ity, use the [eq] operator instead. ====== % expr { 1 == 2 } 0 % expr { 1 == 1 } 1 % expr { 0x1f == 31 } 1 ====== ---- To show you should be careful comparing floats: ====== % expr { 1 == 1.0000000000000001110223 } 1 ====== Comparing with zero is a lot safer: ====== expr { 0 == 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 } 0 ====== but ====== expr { 0 == 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 } 1 ====== So from 1E-324 Tcl does not see the difference with zero any-more. To write it a bit more clear: ====== % expr { 0 == 1E-323 } 0 % expr { 0 == 1E-324 } 1 ====== [DKF]: The issue there is the classic "floating point math doesn't have infinite precision" problem, and is common across all programming languages that use floating point. (Infinite precision floats are possible, but are stupidly expensive and involve really scary mathematics...) The good thing is that the standard algorithms for fixing this work, and Tcl evaluates expressions in a defined, deterministic order. <> Operator