On Friday 09 May 2008 17:13:02 Eric Firing wrote: > Anne Archibald wrote: > > 2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > >> md = make_mask((fb != fb.astype(int)) & (fa < 0), shrink=True) > > > > Unfortunately this isn't quite the right condition: > > > > In [18]: x = 2.**35; numpy.array([-1.])**x; numpy.array(x).astype(int)==x > > Out[18]: array([ 1.]) > > Out[18]: False > > > > Switching to int64 seems to help:
> There may not be a perfect solution, but I suspect your suggestion to > use int64 is more than good enough to get things going for a 1.1 > release. The docstring could note the limitation. If it is established > that the calculation will fail for a power outside some domain, then > such a domain check could be added to the mask. Interestingly, I notice that MaskedArray misses a __pow__ method: it uses the ndarray.__pow__ method instead, that may outputs NaNs. In other terms, I gonna have to code MaskedArray.__pow__, following Eric' example, with int64 instead of int. But, why don't we compare: abs(np.array(b).astype(int)-b).max()<np.finfo(float).precision instead ? At which point will b be considered sufficiently close to an integer that x**b won't return NaN ? _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
