[Numpy-discussion] floating point char - bug?

Christian K. ckkart at hoc.net
Sun Aug 31 15:14:33 EDT 2008


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.

Reagrds, Christian




More information about the NumPy-Discussion mailing list