Hacker News new | ask | show | jobs
by masklinn 2489 days ago
> Yet another reminder that floating point calculations are approximations, and not exact.

floating-point calculations are absolutely exact. What's not is conversions between decimals and floating-point.

2 comments

Their not being exact is why 0.49999997 + 0.5 = 1. There isn't enough precision in the range just below 1.0 to represent the number 0.99999997.
> floating-point calculations are absolutely exact

Are you sure about that? What about 1.00000000000001^2 (using eg 64 bit double)?

Maybe the parent wanted to say that the result is detetministic and not far too off from the true value (in fact, as accurate as possible given the format). In the other words FP is exact but abides by a slight different calculation rule involving rounding.
Floating point is usually deterministic, but from a math point of view it is inexact (in most cases it only approximates the exact answer). In many cases that is fine, which is why it is used, but it is important to remember that.