floating Pt. Division errors in Windows 2000

Peter Hansen peter at engcorp.com
Fri Nov 30 06:10:45 CET 2001


Leon Webster wrote:
> 
> I am just learning Python using the book Learning Python.  Here's a sample
> problem from the book:
> >>>a = 3
> >>>b =4
> >>>b/(2.0 + a)
> 0.80000000000000004
> 
> Does anyone know why this happens?  Is this a problem with Python on Windows
> or Win 2k?

Neither.  See the FAQ, and observe also:

>>> a = 3
>>> b = 4
>>> print b / (2.0 + a)
0.8

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list