2015-05-27 14:24 GMT+02:00 Sean P. DeNigris <[email protected]>:

> Nicolas Cellier wrote
> > Also because it's good to know that 1/10 ~= 0.1
>
> Why? It's an implementation detail. #= unlike #== is IIUC supposed to be
> logical to the domain, and math doesn't make any distinction about how bits
> are stored ;)
>
>
>
Nope, it's more than a detail.
It's what every engineer should know about floating point.
If you think float == real number then you'll be screwed by many unexpected
behavior, like why 0.1+0.1+0.1 ~= 0.3 etc...
So you have to somehow unlearn what you were teached in math, because it's
simply not true with float.
And the faster you get this feedback, the better.



>
> -----
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Inconsistent-number-comparison-tp4828795p4828892.html
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.
>
>

Reply via email to