[Numpy-discussion] making the distinction between -0.0 and 0.0..
Tue Sep 29 12:40:56 CDT 2009
Christopher Barker wrote:
> Pauli Virtanen wrote:
>> Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote:
>>> How can I identify -0.0?
> perfect for numpy, but at this point I don't have a numpy dependency
> (very unusual for my code!). Anyone know a pure-python way to get it?
Starting with Python 2.6, there is a copysign function in the math module:
>>> import math
>>> math.copysign(1, -0.)
>>> math.copysign(1, 0.)
More information about the NumPy-Discussion