[Numpy-discussion] f.p. powers and masked arrays

Michael Fitzgerald mpfitz at calmail.berkeley.edu
Fri Jun 23 17:15:58 EDT 2006


Ping!

Is anyone else seeing this?  It should be easy to test.  If so, I  
think it's a bug.

Best,
Mike


On Jun 21, 2006, at 9:39 PM, Michael Fitzgerald wrote:

>
> Hello all,
>
> I'm encountering some (relatively new?) behavior with masked arrays  
> that
> strikes me as bizarre.  Raising zero to a floating-point value is  
> triggering
> a mask to be set, even though the result should be well-defined.   
> When using
> fixed-point integers for powers, everything works as expected.  I'm  
> seeing
> this with both numarray and numpy.  Take the case of 0**1,  
> illustrated below:
>
>>>> import numarray as n1
>>>> import numarray.ma as n1ma
>>>> n1.array(0.)**1
> array(0.0)
>>>> n1.array(0.)**1.
> array(0.0)
>>>> n1ma.array(0.)**1
> array(0.0)
>>>> n1ma.array(0.)**1.
> array(data =
>  [1.0000000200408773e+20],
>       mask =
>  1,
>       fill_value=[  1.00000002e+20])
>
>>>> import numpy as n2
>>>> import numpy.core.ma as n2ma
>>>> n2.array(0.)**1
> array(0.0)
>>>> n2.array(0.)**1.
> array(0.0)
>>>> n2ma.array(0.)**1
> array(0.0)
>>>> n2ma.array(0.)**1.
> array(data =
>  1e+20,
>       mask =
>  True,
>       fill_value=1e+20)
>
> I've been using python v2.3.5 & v.2.4.3, numarray v1.5.1, and numpy  
> v0.9.8,
> and tested this on an x86 Debian box and a PPC OSX box.  It may be  
> the case
> that this issue has manifested in the past several months, as it's  
> causing a
> new problem with some of my older code.  Any thoughts?
>
> Thanks in advance,
> Mike
>
>
> All the advantages of Linux Managed Hosting--Without the Cost and  
> Risk!
> Fully trained technicians. The highest number of Red Hat  
> certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion





More information about the NumPy-Discussion mailing list