Christopher Barker wrote: > Pauli Virtanen wrote: > >> Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote: >> [clip] >> >>> How can I identify -0.0? >>> >> signbit >> >> > > 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.) -1.0 >>> math.copysign(1, 0.) 1.0 http://docs.python.org/library/math.html HTH, Xavier _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion