complex(3) — Subroutines
NAME
csin, ccos, cdiv, cexp, clog, cmul, cpow, csqrt − Complex functions
SYNOPSIS
#include <math.h>
double_complex csin(
double x,
double y ); float_complex csinf(
float x,
float y ); double_complex ccos(
double x,
double y ); float_complex ccosf(
float x,
float y ); double_complex cdiv(
double a,
double b,
double c,
double d ); float_complex cdivf(
float a,
float b,
float c,
float d ); double_complex cexp(
double x,
double y ); float_complex cexpf(
float x,
float y ); double_complex clog(
double x,
double y ); float_complex clogf(
float x,
float y ); double_complex cmul(
double a,
double b,
double c,
double d ); float_complex cmulf(
float a,
float b,
float c,
float d ); double_complex cpow(
double a,
double b,
double c,
double d ); float_complex cpowf(
float a,
float b,
float c,
float d ); double_complex csqrt(
double x,
double y ); float_complex csqrtf(
float x,
float y );
LIBRARY
Math Library (libm)
DESCRIPTION
These functions can only be called from languages that support the double_complex and float_complex data types.
csin() and csinf() compute the sine of a complex number.
ccos() and ccosf() return the cosine of a complex number.
cdiv() and cdivf() return the quotient of two complex numbers: (a+ib)/(c+id).
cexp() and cexpf() return the exponential of a complex number.
clog() and clogf() return the natural logarithm of a complex number.
cmul() and cmulf() return the product of two complex numbers. cmul(a,b,c,d) is equivalent to (a + ib) ∗ (c + id).
cpow() and cpowf() raise a complex base (a + ib) to a complex exponent (c + id). cpow(a,b,c,d) is equivalent to e∗∗((c + id) ln(a + ib)).
csqrt() and csqrtf() compute the square root of a complex number, x + iy. The real part of csqrt is greater than or equal to zero.
| Function | Exceptional Argument | Routine Behavior |
| csin(), csinf() | |y| = infinity | invalid argument |
| csin(), csinf() | (sinh x sin y) > max_float | overflow |
| csin(), csinf() | (cosh x cos y) > max_float | overflow |
| ccos(), ccosf() | |y| = infinity | invalid argument |
| ccos(), ccosf() | (sin x sinh y) > max_float | overflow |
| ccos(), ccosf() | (cos x cosh y) > max_float | overflow |
| cdiv(), cdivf() | c=0 and d=0 | divide by zero |
| cdiv(), cdivf() | a=b=c=d=0 | invalid argument |
| cexp(), cexpf() | |y| = infinity | invalid argument |
| cexp(), cexpf() | |e∗∗x cos y| > max_float | overflow |
| cexp(), cexpf() | |e∗∗x sin y| > max_float | overflow |
| cexp(), cexpf() | |e∗∗x cos y| < min_float | underflow |
| cexp(), cexpf() | |e∗∗x sin y| < min_float | underflow |
| clog(), clogf() | y=0 and x=0 | invalid argument |
| clog(), clogf() | |x| = |y| = infinity | invalid argument |
| cpow(), cpowf() | sqrt(a∗∗2 + b∗∗2) > max_float | overflow |
| cpow(), cpowf() | c/2 ∗ ln(a∗∗2 + b∗∗2) > max_float | overflow |
| cpow(), cpowf() | c/2 ∗ ln(a∗∗2 + b∗∗2) − (d ∗ atan2(b,c)) > max_float | overflow |
| Value Name | Data Type | Hexadecimal Value | Decimal Value |
| max_float | F_FLOAT | FFFF7FFF | 1.701411e38 |
| G_FLOAT | FFFFFFFFFFFF7FFF | 8.988465674311579e307 | |
| S_FLOAT | 7F7FFFFF | 3.402823e38 | |
| T_FLOAT | 7FEFFFFFFFFFFFFF | 1.797693134862316e308 | |
| min_float | F_FLOAT | 00000080 | 2.9387359e-39 |
| G_FLOAT | 0000000000000010 | 5.562684646268003e-309 | |
| S_FLOAT | 00000001 | 1.4012985e-45 | |
| T_FLOAT | 0000000000000001 | 4.940656458412465e-324 |