[Numpy-discussion] Binary ufuncs: minimum
Tue May 27 18:27:39 CDT 2008
On Tue, May 27, 2008 at 5:39 PM, Christopher Barker
> 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?
IMO abs() returning non-negative numbers is a more fundamental
property. In-place operations on integer arrays are somewhat
dangerous, and best left to more sophisticated users anyway.
Interestingly, MATLAB (v7.5.0) takes a different approach:
>> A = int8([ -128, 1])
Nathan Bell email@example.com
More information about the Numpy-discussion