[issue829370] math.signum(int)

Merlijn van Deen report at bugs.python.org
Thu Mar 15 15:31:29 CET 2012


Merlijn van Deen <valhallasw at gmail.com> added the comment:

I'm not quite sure why that formula would be "elegant" in the first place, and I most certainly don't understand why

0.5*sign((100*YY)+MM-190002.5) + 0.5

is more elegant than

((100*YY)+MM > 190002.5)

or

(((YY = 1900) and (MM > 2.5)) or (YY > 1900))

or rather: implementing leap years correctly in the first place, so the formula also works outside of the 1800-2099 range.


And, in general, I don't understand the problem. Everyone who does scientific computing has numpy *anyway*, so there is no gain for them.

As a last note, the C math.h also doesn't have a sign() function, and only a copysign() function: http://en.wikipedia.org/wiki/C_mathematical_functions

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue829370>
_______________________________________


More information about the Python-bugs-list mailing list