[Numpy-discussion] Binary ufuncs: minimum

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


On Tue, May 27, 2008 at 4:39 PM, Christopher Barker <Chris.Barker@noaa.gov>
wrote:

> Travis E. Oliphant wrote:
> > Yes, it does make sense to me for abs to use an unsigned type for
> integers.
>
> I'm not so sure. I know I wouldn't expect to get a different type back
> with a call to abs(). Do we really want to change that expectation just
> for the case of MIN_INT?
>
> While everyone is going to want an unsigned value when calling abs(),
> who knows if they might want to use negative numbers later? Like:
>
> x = abs(x)
> x *= -1
>
> Now what do we get/want?
>

That one actually works if you view the result as signed ;) I guess it
depends on what guarantees we want to make, which is what this is all about.

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


More information about the Numpy-discussion mailing list