[NumPy-Tickets] [NumPy] #1589: loadtxt reads floats in as float32 instead of float64 under certain cicumstances
NumPy Trac
numpy-tickets@scipy....
Sat Aug 21 14:22:47 CDT 2010
#1589: loadtxt reads floats in as float32 instead of float64 under certain
cicumstances
-------------------------+--------------------------------------------------
Reporter: robitaille | Owner: somebody
Type: defect | Status: closed
Priority: high | Milestone: 2.0.0
Component: Other | Version: devel
Resolution: invalid | Keywords:
-------------------------+--------------------------------------------------
Changes (by pv):
* status: new => closed
* resolution: => invalid
Comment:
It's a printing issue, the data is correctly loaded (check the dtype), and
no rounding occurs at any point:
{{{
>>> import numpy as np
>>> x = np.array(-0.99999999961922814)
>>> x
array(-0.99999999961922814)
>>> y
array([-1., -1., -1.])
>>> np.set_printoptions(precision=14)
>>> y
array([-0.99999999961923, -0.99999999961923, -0.99999999961923])
}}}
Now, one can argue `eval(repr(x))` should equal `x` whenever possible.
However, since Numpy is used extensively interactively, obeying the
current print precision probably makes more sense.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1589#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list