3.2*2 is 9.6 ... or maybe it isn't?

Emile van Sebille emile at fenx.com
Thu Jun 25 20:29:32 CEST 2009


On 6/25/2009 11:04 AM Bojan Sudarevic said...

<snip>

>>>> 3.2*3
> 9.600000000000001
> 
> I wasn't particularly good in math in school and university, but I'm 
> pretty sure that 3.2*3 is 9.6.

Yes -- in this world.  But in the inner workings of computers, 3.2 isn't
accurately representable in binary.  This is a faq.

ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> 3.2
3.2000000000000002
 >>>


Emile





More information about the Python-list mailing list