[NumPy-Tickets] [NumPy] #1395: incorrect conversion from float128 to long

NumPy Trac numpy-tickets@scipy....
Tue Feb 9 17:05:18 CST 2010


#1395: incorrect conversion from float128 to long
------------------------+---------------------------------------------------
 Reporter:  amcnabb     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.core  |     Version:          
 Keywords:              |  
------------------------+---------------------------------------------------
 I created a float128 and confirmed that it indeed holds a 20 digit number.
 However, when I converted it to a Python long (which should be able to
 hold an arbitrarily large integer), the result was only as accurate as a
 float64.

 >>> a = (numpy.float128(1234567890) * 10**10 + 1234567890)
 >>> a
 12345678901234567890.0
 >>> long(a)
 12345678901234567168L
 >>>

 The correct result for long(a) would be 12345678901234567890L.  I am using
 numpy-1.3.0-6.fc12.x86_64 and python-2.6.2-2.fc12.x86_64.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1395>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list