Re:0.3 - 0.2 == 0.2 - 0.1 is falsy. Which language gets this...
by rprasad on Thursday October 04, 2012 @12:40PM
(#4613135)
Any language which uses floating points to represent these values rather than fixed points.
C# and some versions of C use fixed-point representations for these values by default (or correct for floating point errors internally, as with C#), and return the correct answer of true, as .1 is equal to .1 in fixed-point representations.
EDIT: False is only the correct answer when using floating point representations, as the equation no longer boils down to .1 == .1, but something like .999 == 1.0001, etc.
C# and some versions of C use fixed-point representations for these values by default (or correct for floating point errors internally, as with C#), and return the correct answer of true, as .1 is equal to .1 in fixed-point representations.
EDIT: False is only the correct answer when using floating point representations, as the equation no longer boils down to .1 == .1, but something like .999 == 1.0001, etc.