[Numpy-tickets] [NumPy] #902: inconsistent float to string conversion with german locale

NumPy numpy-tickets@scipy....
Sun Aug 31 15:28:15 CDT 2008


#902: inconsistent  float to string conversion with german locale
------------------------+---------------------------------------------------
 Reporter:  ChristianK  |       Owner:  somebody                  
     Type:  defect      |      Status:  new                       
 Priority:  normal      |   Milestone:  1.2.0                     
Component:  numpy.core  |     Version:  1.1.1                     
 Severity:  major       |    Keywords:  locale repr floating point
------------------------+---------------------------------------------------
 The string representation of numpy.floatxx object is inconsistent on
 systems with german locale:

 {{{
 import locale
 locale.str(1.2)
 '1,2'
 a = N.linspace(0,1,5)
 a
 array([ 0.  ,  0.25,  0.5 ,  0.75,  1.  ])
 a.astype(float)
 array([ 0.  ,  0.25,  0.5 ,  0.75,  1.  ])
 a[0].astype(float)
 0.0
 a[1].astype(float)
 0,25
 }}}

 Note that 0 got converted to '0.0' whereas 0.25 yielded '0,25' using a
 comma as floating point in accordance with german locale.

 I vote against accounting for locale settings at all when printing numpy
 floats.

 Christian

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/902>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list