[Numpy-discussion] Bug in loadtxt

Thomas Robitaille thomas.robitaille@gmail....
Sat Aug 21 13:03:13 CDT 2010



josef.pktd wrote:
> 
> are you sure this is not just a print precision problem?
> 

Thanks for pointing this out, it does seem to be just to do with the
printing precision. I didn't notice this before, because for the last few
elements of the array, print still gives just -1:

In [19]: for x in a:
   ....:     print x
   ....:     
   ....:     
-0.999999999619
-0.999999999962
-0.999999999996
-1.0
-1.0
-1.0
-1.0

But I now realize that to get the full precision, I should have done

In [20]: for x in a:
   ....:     repr(x)
   ....:     
   ....:     
Out[20]: '-0.99999999961922814'
Out[20]: '-0.9999999999619229'
Out[20]: '-0.99999999999619227'
Out[20]: '-0.99999999999961919'
Out[20]: '-0.99999999999996192'
Out[20]: '-0.99999999999999611'
Out[20]: '-1.0'

Cheers,

Tom




-- 
View this message in context: http://old.nabble.com/Bug-in-loadtxt-tp29500522p29500609.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.



More information about the NumPy-Discussion mailing list