[Numpy-discussion] Binary ufuncs: minimum

Charles R Harris charlesr.harris@gmail....
Tue May 27 19:27:18 CDT 2008

On Tue, May 27, 2008 at 6:08 PM, Christopher Barker <Chris.Barker@noaa.gov>

> Charles R Harris wrote:
> > I guess it
> > depends on what guarantees we want to make, which is what this is all
> about.
> Exactly. However, while I'd like to guarantee that abs(x) >= 0, the
> truth is that numpy is "close to the metal" in a lot of ways, and anyone
> should know that the arithmetic of integers near max and minimum values
> is fraught with danger.
> If we don't change the type, then any number other than MIN_INT works
> correctly. I think more code will break by silently going from a signed
> to a signed type than that one value being weird.

I disagree. By definition, abs() >= 0 always. The only time having an
unsigned return will cause problems is in the augmented assignments, and
they already cause problems by not raising errors on mixed type operations,
so let the user beware.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080527/fc8d5806/attachment.html 

More information about the Numpy-discussion mailing list