Hacker News new | past | comments | ask | show | jobs | submit
.125 + .375 == .5

You should be using == for floats when they're actually equal. 0.1 just isn't an actual number.

Are you saying that my students should memorize which numbers are actual floats and which are not?

    > 1.25 * 0.1
    
    0.1250000000000000069388939039
loading story #47399943
loading story #47400622
loading story #47400611
loading story #47400390
> 0.1 just isn't an actual number.

A finitist computer scientists only accepts those numbers as real that can be expressed exactly in finite base-two floating point?