Commit 67b77198 authored by Jerome Kieffer's avatar Jerome Kieffer Committed by Robert Bradshaw

Provide support for the complex library (#2891)

parent 632ec1a0
cdef extern from "<complex.h>" nogil:
# Trigonometric functions.
double complex cacos(double complex z)
double complex casin(double complex z)
double complex catan(double complex z)
double complex ccos(double complex z)
double complex csin(double complex z)
double complex ctan(double complex z)
# Hyperbolic functions.
double complex cacosh(double complex z)
double complex casinh(double complex z)
double complex catanh(double complex z)
double complex ccosh(double complex z)
double complex csinh(double complex z)
double complex ctanh(double complex z)
# Exponential and logarithmic functions.
double complex cexp(double complex z)
double complex clog(double complex z)
double complex clog10(double complex z)
# Power functions.
double complex cpow(double complex x, double complex y)
double complex csqrt(double complex z)
# Absolute value, conjugates, and projection.
double cabs(double complex z)
double carg(double complex z)
double complex conj(double complex z)
double complex cproj(double complex z)
# Decomposing complex values.
double cimag(double complex z)
double creal(double complex z)
# ticket: 2891
# tag: c, no-cpp
cdef extern from "complex_numbers_c99_T398.h": pass
from libc.complex cimport cimag, creal, cabs, carg
def test_decomposing(double complex z):
"""
>>> test_decomposing(3+4j)
(3.0, 4.0, 5.0, 0.9272952180016122)
"""
return (creal(z), cimag(z), cabs(z), carg(z))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment