float64 print digits
Ulrich Dorda
ulrich.dorda at cern.ch
Fri Mar 2 11:35:50 CET 2007
I need a pytho nscript to read numbers(with loads of digits) from a
file, do some basic math on it and write the result out to another file.
My problem: I don't get python to use more digits:
In order to try this I type:
The normal precision one:
>>> from numpy import *
>>> x=1.23456789123456789123456789
>>> print "%35.25e" %x
1.2345678912345679000000000e+000
Now I try to use float64 to get more digits
>>> z=zeros(3,float64)
>>> z[0]
0.0
>>> type(z[0])
<type 'numpy.float64'>
>>> z[0]=1.23456789123456789123456789
>>> type(z[0])
<type 'numpy.float64'>
>>> print "%35.25e" %z[0]
1.2345678912345679000000000e+000
This cuts the digits just like the 32bit case.
Can anyone please help me get more digits?
Thank you very much in advance,
Ulrich
More information about the Python-list
mailing list