[issue27739] add math.sign/signum

2016-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks David. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue27739] add math.sign/signum

2016-08-11 Thread R. David Murray
R. David Murray added the comment: This has been previously discussed and rejected, in issue 829370. -- nosy: +r.david.murray resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> math.signum(int) ___ Python tracker

[issue27739] add math.sign/signum

2016-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: copysign() is part of the standard C maths library (that is why it was added to the math module). sgn/sign/signum was used in old languages that didn't have copysign() (Basic, Pascal, etc). -- ___ Python tracker

[issue27739] add math.sign/signum

2016-08-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: If this is added, should this signum function be the two value version that returns 1 for zero, or the three value version that returns 0? Should it distinguish between signed zeroes +0.0 and -0.0? What should it do for NANs (raise, return a NAN, copy the

[issue27739] add math.sign/signum

2016-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: sgn(x) is the same as copysign(1.0, x). The math module doesn't support complex numbers and shouldn't. -- ___ Python tracker

[issue27739] add math.sign/signum

2016-08-11 Thread Ankur Dedania
Ankur Dedania added the comment: sign/signum isn't the same as copysign, and doesn't support complex numbers -- ___ Python tracker ___

[issue27739] add math.sign/signum

2016-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See math.copysign(). https://docs.python.org/3/library/math.html#math.copysign -- nosy: +serhiy.storchaka ___ Python tracker

[issue27739] add math.sign/signum

2016-08-11 Thread Ankur Dedania
New submission from Ankur Dedania: Add a new function to the math module sign/signum https://en.wikipedia.org/wiki/Sign_function -- messages: 272459 nosy: AnkurDedania priority: normal severity: normal status: open title: add math.sign/signum type: enhancement versions: Python 3.6