[Numpy-discussion] floating point char - bug?

Christian K. ckkart at hoc.net
Sun Aug 31 16:29:21 EDT 2008


Charles R Harris schrieb:
> 
> 
> On Sun, Aug 31, 2008 at 1:14 PM, Christian K. <ckkart at hoc.net 
> <mailto:ckkart at hoc.net>> wrote:
> 
>     Hi,
> 
>     I just came across somethin I never noticed before. I cannot say whether
>     this is due to an update of numpy but it is possible - I am running
>     1.1.1 on __german__ windows. Here is the observation:
> 
>     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
> 
>     As you see in the last line, suddenly numpy picks up the german locale
>     setting and converts the floating point into a comma. It does not affect
>     the '0.0' in the line above and I believe to have seen some other
>     numbers ending with '.0' where the point has not been replaced.
>     I guess this is a bug. In fact I do not like the idea that repr() of a
>     numpy float honours the locale settings.
> 
> 
> I'd call it a bug, file a ticket. And we do need to have a policy on 
> locales.

Done. http://scipy.org/scipy/numpy/ticket/902

Christian




More information about the NumPy-Discussion mailing list