Hi all,
I am trying to read some 19-digit integers using loadtxt (or genfromtxt
-- same problem). The numbers are smaller than the max int64 (and the
max uint64 -- same problem with either one).
Below, Out[184] shows that python has no problem with the conversion,
but loadtxt gets the last few digits wrong in Out[185].
Am I doing something stupid?
Yours,
Andrew
In [175]: import numpy as np
In [176]: np.__version__
Out[176]: '1.4.0'
In [177]: from StringIO import StringIO
In [178]: fc = """1621174818000457763
1621209600996363377
1621258907994644735
1621296000994995765
1621374194996298305
"""
In [184]: long(fc[:19])
Out[184]: 1621174818000457763L
In [185]: np.loadtxt(StringIO(fc), dtype=np.int64)
Out[185]:
array([1621174818000457728, 1621209600996363264, 1621258907994644736,
1621296000994995712, 1621374194996298240], dtype=int64)
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion