Python fails on math

Terry Reedy tjreedy at
Tue Feb 22 20:06:49 EST 2011

On 2/22/2011 2:42 PM, Grant Edwards wrote:

> Except that Python (and computer languages in general) don't deal with
> real numbers.  They deal with floating point numbers, which aren't the
> same thing.  [In case anybody is still fuzzy about that.]

In particular, floats are a fixed finite set of rationals with adjusted 
definitions of the arithmetic operators. The adjustment is necessary 
because the 'proper' answer to an operation may not be one of the 
allowed answers. In other words, f1 float-op f2 may not be the same as 
f1 rat-op f2, and hence float-ops do not always obey the rules of 
rational (or real) operations.

Terry Jan Reedy

More information about the Python-list mailing list