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:
from libc.math cimport expl
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 call expl, exp, cexp or expf depending on the static type of x). If we did:
cdef extern from "<tgmath.h>" nogil:
long double exp(long double x)
def foo(float x):
cdef float y
y = exp(x)
would that end up generating appropriate C to call expf via the macro, or would the Cython declaration cause an upcast to long double? I couldn't find documentation for what assumptions Cython makes about the types relating to extern'd macros.
The
libc.mathmodule (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.mathequivalents (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,cexporexpfdepending on the static type ofx). If we did:would that end up generating appropriate C to call
expfvia 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.