code not true?

David Goodger dgoodger at bigfoot.com
Sun Apr 23 00:28:45 EDT 2000


on 2000-04-23 00:14, Michal Wallace (sabren) (sabren at manifestation.com)
wrote:
>> 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?

Try writing 1/3 in decimal. How many digits do you need to represent it
*exactly*? Same issue for 0.07 in binary floating point.

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)




More information about the Python-list mailing list