code not true?

Robin Becker robin at jessikat.demon.co.uk
Sat Apr 22 14:19:03 CEST 2000


In article <8ds3ku$q0l$1 at nnrp1.deja.com>, jeff_islay at my-deja.com writes
>Why does the second example return false?
>
>>>> print 7.0 == 7
>1
>>>> print (.07 * 100) == 7
>0
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

.07 isn't exactly representable in your (probably IEEE) binary floating
point representation.

print .07*100 -7
8.8817841970012523e-016 
-- 
Robin Becker



More information about the Python-list mailing list