This math scares me

David C. Ullrich ullrich at
Tue Mar 13 17:35:10 CET 2001

On Tue, 13 Mar 2001 13:37:46 GMT, David Fuess <fuess at> wrote:

>On Mon, 12 Mar 2001 17:03:56 -0500, William Park <parkw at>
>>On Mon, Mar 12, 2001 at 09:34:58PM +0000, costas at wrote:
>>> Ok, I can see maybe division having problems. But why does addition of
>>> the two numbers below:
>>> 5.01+5.54
>>> give me this?
>>> 10.550000000000001
>>It's called 'Round-off error'.
>Well, truncation error actually 

Actually it's round-off error. Truncation error is something else.
(It happens a lot that we have something that _converges_
to the right answer but we don't have time to wait: We're
adding an infinite series but we actually only consider the
first N terms, or we have some iterative scheme to approximate
the solution to something and we stop after the first N
iterations, whatever. The truncation error is the error that
gets introduced because we only took finitely many terms -
it's the error that would be there even if the individual
steps were exact calculuations, the error induced by the
fact that the algorithm we're actually _using_ does not
quite give the right answer even theoretically. Otoh the 
round-off error is the error introduced by the fact that 
the individual steps are not exactly right. Here there
is no truncation error: the expression "5.01+5.54"
should theoretically give the exact value of the sum
of those two numbers.)

>But who's counting? 

Nobody, luckily.

>(The name derives
>from truncating the infinite sequence to the finite number of bits
>available for representing the floating point mantissa.)
>>---William Park, Open Geometry Consulting, Linux/Python, 8 CPUs.

More information about the Python-list mailing list