Simple addition
Rod Haper
rhaper at houston.rr.com
Mon Feb 16 23:15:02 EST 2004
Rainer Deyke wrote:
> Dan Bishop wrote:
>
>>Why not display the *exact* decimal representation,
>>"0.1000000000000000055511151231257827021181583404541015625"?
>
>
> This has my vote. Unfortunately Python seems incapable of figuring out all
> of those digits.
>
> Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>
>>>>'%.64f' % 0.1
>
> '0.1000000000000000100000000000000000000000000000000000000000000000'
>
>
Python 2.3.3 seems to be able to do it on Red Hat Linux 9.0:
[rodh at rodh rodh]$ python
Python 2.3.3 (#1, Dec 20 2003, 17:47:13)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> '%.64f' % 0.1
'0.1000000000000000055511151231257827021181583404541015625000000000'
>>>
Must be a M$ MSC problem.
--
Rod
More information about the Python-list
mailing list