News for hackers. Stuff that matters.
Re:0.3 - 0.2 == 0.2 - 0.1 is falsy. Which language gets this... by shangaslammi on Friday October 05, 2012 @02:33AM (#4615906)
In Haskell, decimal literals can be inferred as any Fractional type (including Rational, which is precise), but they default to Double if there is no context that dictates otherwise.

    Prelude> 0.3 - 0.2 == 0.2 - (0.1 :: Rational)
    True
Above, we explicitly declare one of the literals as Rational, and the rest are inferred as having the same type (since the standard library does not allow you to do arithmetics or comparisons between discrepant types).

There are no comments on this comment yet.