[Numpy-tickets] [NumPy] #630: If float('123.45') works, so should numpy.float32('123.45')

NumPy numpy-tickets@scipy....
Thu Dec 20 01:54:45 CST 2007

#630: If float('123.45') works, so should numpy.float32('123.45')
 Reporter:  AndrewStraw  |        Owner:  somebody
     Type:  defect       |       Status:  new     
 Priority:  normal       |    Milestone:          
Component:  numpy.core   |      Version:  none    
 Severity:  normal       |   Resolution:          
 Keywords:               |  
Comment (by AndrewStraw):

 I'm unsure what your patch is attempting to fix. Anyhow, it doesn't fix
 specifically what I meant:

 $ python -c "from numpy import float32; float32('1.2345')"
 Traceback (most recent call last):
   File "<string>", line 1, in ?
 ValueError: setting an array element with a sequence.

 Also, after reading http://bugs.python.org/issue1580 , I have realized
 that the possibility of having a numpy-specific decimal-to-binary
 conversion routine is more complicated than I thought. Thus, numpy
 supporting conversions from string to extended (or quad) precision floats
 is probably not easy. For float32, though, we can probably use Python's
 double-precision algorithm and then make sure we round correctly to single

Ticket URL: <http://scipy.org/scipy/numpy/ticket/630#comment:4>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list