numpy 2.0.0
src/npymath/npy_math_complex.c.src File Reference
#include "npy_math_common.h"
#include "npy_math_private.h"

Defines

#define THRESH   (@TMAX@ / (1 + NPY_SQRT2@c@))

Functions

type npy_cabs c (@ctype @z)
ctype npy_cpow c (@ctype @x,@ctype @y)

Define Documentation

#define THRESH   (@TMAX@ / (1 + NPY_SQRT2@c@))
We risk spurious overflow for components >= DBL_MAX / (1 + sqrt(2)).

Function Documentation

ctype npy_csin c ( @ctype @  z)
System Message: SEVERE/4 (<string>, line 1)
Title overline & underline mismatch.

==========================================================
 Custom implementation of missing complex C99 functions
=========================================================
begin repeat
type = float,double,npy_longdouble# #ctype = npy_cfloat,npy_cdouble,npy_clongdouble# c = f, , l# C = F, , L# #TMAX = FLT_MAX, DBL_MAX, LDBL_MAX#

r is nan
r is +- inf
x = +inf, y = +-inf | nan
x = -inf, y = nan | +i inf
Handle special cases.

<

raise invalid if b is not a NaN

<

return NaN + NaN i
csqrt(inf + NaN i) = inf + NaN i csqrt(inf + y i) = inf + 0 i csqrt(-inf + NaN i) = NaN +- inf i csqrt(-inf + y i) = 0 + inf i
The remaining special case (b is NaN) is handled just fine by the normal code path below.
Scale to avoid overflow.
Algorithm 312, CACM vol 10, Oct 1967.
Rescale.

References c, npy_cimag(), npy_copysign(), npy_cos(), npy_cpack(), npy_creal(), npy_exp(), npy_isfinite, npy_isnan, NPY_NAN, npy_sin(), and type().

ctype npy_cpow c ( @ctype @  x,
@ctype @  y 
)