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

Bojan Sudarevic bojan at sudarevic.com
Thu Jun 25 14:04:57 EDT 2009


Hi,

I'm PHP developer and entirely new to Python. I installed it (version 
2.5.2, from Debian repos) today on the persuasion of a friend, who is a 
Python addict.

The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, 
I don*t know, I just did). And the answer wasn't 9.6.

Here it is:

>>> 3.2*3
9.6000000000000014

So I became curious...

>>> 3.21*3
9.629999999999999
>>> (3.2*3)*2
19.200000000000003
... and so on ...

After that I tried Windows version (3.1rc2), and...

>>> 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.

Cheers,
Bojan



More information about the Python-list mailing list