code not true?

Michal Wallace (sabren) sabren at manifestation.com
Sun Apr 23 00:14:43 EDT 2000


On 22 Apr 2000, Remco Gerlich wrote:

> jeff_islay at my-deja.com wrote in comp.lang.python:
> > Why does the second example return false?
> > 
> > >>> print 7.0 == 7
> > 1
> > >>> print (.07 * 100) == 7
> > 0
> 
> Floating point number on a binary computer are strange. They're not that
> accurate. 0.07 * 100 != 7.0.

Why is this the case? I mean.. I understand why decimals are hard to
show in binary... But why can't we use variably long strings, or
something? Is it just a speed issue?

Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





More information about the Python-list mailing list