[Numpy-discussion] floating point char - bug?

Charles R Harris charlesr.harris at gmail.com
Sun Aug 31 15:28:50 EDT 2008


On Sun, Aug 31, 2008 at 1:14 PM, Christian K. <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.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080831/ab212e9f/attachment.html>


More information about the NumPy-Discussion mailing list