Hacker News new | ask | show | jobs
by dns_snek 1337 days ago
The online version, at least, seems to be wrong when you do wrap it in parentheses:

=(4/3 - 1)*3 - 1 = 0

=((4/3 - 1)*3 - 1) = -2.22045E-16

1 comments

Check out page 3-5 of this paper called How Futile are Mindless Assessments of Roundoff in Floating-Point Computation? [0]. It explains what is happening here better than I can and is where I got this example from.

[0]: https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf