2008/5/7 Eric Firing <[EMAIL PROTECTED]>:
> Charles Doutriaux wrote:
>  > The following code works with numpy.ma but not numpy.oldnumeric.ma,
>
>  No, this is a bug in numpy.ma also; power is broken:

While it's tempting to just call power() and mask out any NaNs that
result, that's going to be a problem if people have their environments
set to raise exceptions on the production of NaNs. Is it an adequate
criterion to check (a<0) & (round(b)==b)? We have to be careful:

In [16]: np.array([-1.0])**(2.0**128)
Warning: invalid value encountered in power
Out[16]: array([                  nan])

2.0**128 cannot be distinguished from nearby non-integral values, so
this is reasonable behaviour (and a weird corner case), but

In [23]: np.round(2.0**128) == 2.0**128
Out[23]: True

Anne
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to