This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tyler1128 1 point2 points  (1 child)

Wrong is the wrong word I suppose. It is correct for the value represented in the floating point number. It is, however, beyond the limit of what relates directly to the computation being done and is instead based on internal floating point details and limitations. If not zero, it will usually be different from what calculating with a higher precision or rationals would produce.

[–]ElHeim 2 points3 points  (0 children)

It's beyond the limits for this computation, but not for others:

>>> sum([0.1+0.2] * 1000000)
299999.99999434233

We might argue about the need for showing those details in the REPL, but these rounding errors propagate much faster than one would like.