In a recently merged PR (https://github.com/python/cpython/pull/150555),
CPython has added a family of "*pi" functions to the math module, which take
half-turn arguments instead of radians. One reason these functions are
advantageous is that it's easy to provide the property that `sinpi(n/2)` is
exact for all integers n, while `sin(pi*n)` is never exactly equal to the
mathematical ideal except for n=0.
These functions are recommended by IEEE754-2019 and standardized in C23 Annex
G. (note: I'm reading C23 draft revised 2023-01-24, not the final standard
document; and I do not have IEEE754-2019).
C23 and CPython only added the real-valued versions of these functions, but C23
"future library directions" notes that identifiers like `csinpi` are
"potentially reserved identifiers."
Since CPython only requires C11, CPython includes implementations of these
functions for when the underling platform library does not provide it. These
implementations work by performing special case handling & range reduction,
followed by a call to the standard trig function with a scaled argument (in the
case of forward functions) or scaling of the result (in the case of inverse/arc
functions).
I am interested in doing the numpy implementation, however I have never done
core numpy work before. If there is interest from the project, I would like to
initially offer a PR containing a single function such as `sinpi` and then
complete the others following numpy core developer feedback.
Thanks,
Jeff
PS I notice via the archives that there are occasional "New Contributors' Hour"
meetings. Is the next one scheduled yet?
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]