New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing long double math functions #3570
Comments
.pxd declarations don't really have portability constraints. They only end up in C code if they are actually used in Cython code. PR welcome.
Cython can do this, too, at least internally (for C mode) and in C++ mode. We do this for Python's The issue with macros that allow for different return types is that Cython would not understand the logic and would use the (wrong) single declared return type in all cases. The normal way to deal with them is to give different Cython names to the same C macro and then call the right one in the Cython code, but that totally counters the idea of a joined dispatcher macro. |
Adds many long double variants (e.g. expl) that were previously omitted. No functions have been (intentionally) removed. I've also re-ordered the functions alphabetically by function name, which improves auditability with respect to lists like: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html I've also normalized parameters, whichd were previously inconsistent: - omit the identifier for trivial parameters - use "type*" consistently instead of "type *" Classes of functions/macros that are still missing: - error-handling ones, like math_errhandling and MATH_ERRNO - Bessel functions like j0, y0 Fixes cython#3570
Adds many long double variants (e.g. expl) that were previously omitted. No functions have been (intentionally) removed. I've also re-ordered the functions alphabetically by function name, which improves auditability with respect to lists like: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html I've also normalized parameters, which were previously inconsistent: - omit the identifier for trivial parameters - use "type*" consistently instead of "type *" Classes of functions/macros that are still missing: - error-handling ones, like math_errhandling and MATH_ERRNO - Bessel functions like j0, y0 Fixes cython#3570
Adds many long double variants (e.g. expl) that were previously omitted. No functions have been (intentionally) removed. I've also re-ordered the functions alphabetically by function name, which improves auditability with respect to lists like: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html I've omitted the identifier for trivial parameters in new functions. However, I've retained them for existing functions for compatibility with legacy kwargs. I've also used "type*" consistently instead of "type *". Classes of functions/macros that are still missing: - error-handling ones, like math_errhandling and MATH_ERRNO - Bessel functions like j0, y0 Fixes cython#3570
Adds many long double variants (e.g. expl) that were previously omitted. No functions have been removed. I've omitted the identifier for trivial parameters in new functions. However, I've retained them for existing functions for compatibility with legacy kwargs. Classes of functions/macros that are still missing: - error-handling ones, like math_errhandling and MATH_ERRNO - Bessel functions like j0, y0 Fixes cython#3570
Adds many long double variants (e.g. expl) that were previously omitted. No functions have been removed. I've omitted the identifier for trivial parameters in new functions. However, I've retained them for existing functions for compatibility with legacy kwargs. Classes of functions/macros that are still missing: - error-handling ones, like math_errhandling and MATH_ERRNO - Bessel functions like j0, y0 Fixes #3570
The
libc.math
module (cython/Cython/Includes/libc/math.pxd) seems to be missing a bunch of long double functions. For example, this will error:I wasn't sure if that was intentional for portability. There's a workaround to use the
numpy.math
equivalents (though one may not want a numpy dependency or the non-system implementation). If it's just an oversight, I can send a PR.Tangentially related: I also considered a new module corresponding to C99's
<tgmath.h>
, which uses macros that expand into the appropriate function call depending on the type (e.g.exp(x)
in C will callexpl
,exp
,cexp
orexpf
depending on the static type ofx
). If we did:would that end up generating appropriate C to call
expf
via the macro, or would the Cython declaration cause an upcast tolong double
? I couldn't find documentation for what assumptions Cython makes about the types relating to extern'd macros.The text was updated successfully, but these errors were encountered: