7.4.14 <complex.h>

Performs various complex number operations. For double-type complex number functions, the definition names are used as function names without change. For float-type and long double-type function names, "f" and "l" are added to the end of definition names, respectively.

Type

Definition Name

Description

Function

cacos <-lang=c99>

Calculates the arc cosine of a complex number.

casin <-lang=c99>

Calculates the arc sine of a complex number.

catan <-lang=c99>

Calculates the arc tangent of a complex number.

ccos <-lang=c99>

Calculates the cosine of a complex number.

csin <-lang=c99>

Calculates the sine of a complex number.

ctan <-lang=c99>

Calculates the tangent of a complex number.

cacosh <-lang=c99>

Calculates the arc hyperbolic cosine of a complex number.

casinh <-lang=c99>

Calculates the arc hyperbolic sine of a complex number.

catanh <-lang=c99>

Calculates the arc hyperbolic tangent of a complex number.

ccosh <-lang=c99>

Calculates the hyperbolic cosine of a complex number.

csinh <-lang=c99>

Calculates the hyperbolic sine of a complex number.

ctanh <-lang=c99>

Calculates the hyperbolic tangent of a complex number.

cexp <-lang=c99>

Calculates the natural logarithm base e raised to the complex power 2.

clog <-lang=c99>

Calculates the natural logarithm of a complex number.

cabs <-lang=c99>

Calculates the absolute value of a complex number.

cpow <-lang=c99>

Calculates a power of a complex number.

csqrt <-lang=c99>

Calculates the square root of a complex number.

carg <-lang=c99>

Calculates the argument of a complex number.

cimag <-lang=c99>

Calculates the imaginary part of a complex number.

conj <-lang=c99>

Reverses the sign of the imaginary part and calculates the complex conjugate of a complex number.

cproj <-lang=c99>

Calculates the projection of a complex number on Riemann sphere.

creal <-lang=c99>

Calculates the real part of a complex number.

 

cacosf/cacos/cacosl

Calculates the arc cosine of a complex number.

[Format]

#include <complex.h>
float complex cacosf(float complex z);
double complex cacos(double complex z);
long double complex cacosl(long double complex z);


[Parameters]

z Complex number for which arc cosine is to be computed

[Return values]

Normal: Complex arc cosine of z

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs for a value of z not in the range [1.0, 1.0].

The cacos function returns the arc cosine in the range [0, ] on the real axis and in the infinite range on the imaginary axis.

 

casinf/casin/casinl

Calculates the arc sine of a complex number.

[Format]

#include <complex.h>
float complex casinf(float complex z);
double complex casin(double complex z);
long double complex casinl(long double complex z);


[Parameters]

z Complex number for which arc sine is to be computed

[Return values]

Normal: Complex arc sine of z

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs for a value of z not in the range [1.0, 1.0].

The casin function returns the arc sine in the range [/2, /2] on the real axis and in the infinite range on the imaginary axis.

 

catanf/catan/catanl

Calculates the arc tangent of a complex number.

[Format]

#include <complex.h>
float complex catanf(float complex z);
double complex catan(double complex z);
long double complex catanl(long double complex z);


[Parameters]

z Complex number for which arc tangent is to be computed

[Return values]

Normal: Complex arc tangent of z

[Remarks]

The catan function returns the arc tangent in the range [/2, /2] on the real axis and in the infinite range on the imaginary axis.

 

ccosf/ccos/ccosl

Calculates the cosine of a complex number.

[Format]

#include <complex.h>
float complex ccosf(float complex z);
double complex ccos(double complex z);
long double complex ccosl(long double complex z);


[Parameters]

z Complex number for which cosine is to be computed

[Return values]

Complex cosine of z

 

csinf/csin/csinl

Calculates the sine of a complex number.

[Format]

#include <complex.h>
float complex csinf(float complex z);
double complex csin(double complex z);
long double complex csinl(long double complex z);


[Parameters]

z Complex number for which sine is to be computed

[Return values]

Complex sine of z

 

ctanf/ctan/ctanl

Calculates the tangent of a complex number.

[Format]

#include <complex.h>
float complex ctanf(float complex z);
double complex ctan(double complex z);
long double complex ctanl(long double complex z);


[Parameters]

z Complex number for which tangent is to be computed

[Return values]

Complex tangent of z

 

cacoshf/cacosh/cacoshl

Calculates the arc hyperbolic cosine of a complex number.

[Format]

#include <complex.h>
float complex cacoshf(float complex z);
double complex cacosh(double complex z);
long double complex cacoshl(long double complex z);


[Parameters]

z Complex number for which arc hyperbolic cosine is to be computed

[Return values]

Normal: Complex arc hyperbolic cosine of z

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs for a value of z not in the range [1.0, 1.0].

The cacoshf function returns the arc hyperbolic cosine in the range [0, ].

 

casinhf/casinh/casinhl

Calculates the arc hyperbolic sine of a complex number.

[Format]

#include <complex.h>
float complex casinhf(float complex z);
double complex casinh(double complex z);
long double complex casinhl(long double complex z);


[Parameters]

z Complex number for which arc hyperbolic sine is to be computed

[Return values]

Complex arc hyperbolic sine of z

 

catanhf/catanh/catanhl

Calculates the arc hyperbolic tangent of a complex number.

[Format]

#include <complex.h>
float complex catanhf(float complex z);
double complex catanh(double complex z);
long double complex catanhl(long double complex z);


[Parameters]

z Complex number for which arc hyperbolic tangent is to be computed

[Return values]

Complex arc hyperbolic tangent of z

 

ccoshf/ccosh/ccoshl

Calculates the hyperbolic cosine of a complex number.

[Format]

#include <complex.h>
float complex ccoshf(float complex z);
double complex ccosh(double complex z);
long double complex ccoshl(long double complex z);


[Parameters]

z Complex number for which hyperbolic cosine is to be computed

[Return values]

Complex hyperbolic cosine of z

 

csinhf/csinh/csinhl

Calculates the hyperbolic sine of a complex number.

[Format]

#include <complex.h>
float complex csinhf(float complex z);
double complex csinh(double complex z);
long double complex csinhl(long double complex z);


[Parameters]

z Complex number for which hyperbolic sine is to be computed

[Return values]

Complex hyperbolic sine of z

 

ctanhf/ctanh/ctanhl

Calculates the hyperbolic tangent of a complex number.

[Format]

#include <complex.h>
float complex ctanhf(float complex z);
double complex ctanh(double complex z);
long double complex ctanhl(long double complex z);


[Parameters]

z Complex number for which hyperbolic tangent is to be computed

[Return values]

Complex hyperbolic tangent of z

 

cexpf/cexp/cexpl

Calculates the exponential function value of a complex number.

[Format]

#include <complex.h>
float complex cexpf(float complex z);
double complex cexp(double complex z);
long double complex cexpl(long double complex z);


[Parameters]

z Complex number for which exponential function is to be computed

[Return values]

Exponential function value of z

 

clogf/clog/clogl

Calculates the natural logarithm of a complex number.

[Format]

#include <complex.h>
float complex clogf(float complex z);
double complex clog(double complex z);
long double complex clogl(long double complex z);


[Parameters]

z Complex number for which natural logarithm is to be computed

[Return values]

Normal: Natural logarithm of z

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs if z is negative.

A range error occurs if z is 0.0.

The clog function returns the natural logarithm in the infinite range on the real axis and in the range [i, +i] on the imaginary axis.

 

cabsf/cabs/cabsl

Calculates the absolute value of a complex number.

[Format]

#include <complex.h>
float cabsf(float complex z);
double cabs(double complex z);
long double cabsl(long double complex z);


[Return values]

Absolute value of z

[Parameters]

z Complex number for which absolute value is to be computed

 

cpowf/cpow/cpowl

Calculates a power of a complex number.

[Format]

#include <complex.h>
float complex cpowf(float complex x, float complex y);
double complex cpow(double complex x, double complex y);
long double complex cpowl(long double complex x, long double complex y);


[Parameters]

x Value to be raised to a power

y Power value

[Return values]

Normal: Value of x raised to the power y

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs if x is 0.0 and y is 0.0 or smaller, or if x is negative and y is not an integer.

The branch cut for the first parameter of the cpow function group is along the negative real axis.

 

csqrtf/csqrt/csqrtl

Calculates the square root of a complex number.

[Format]

#include <complex.h>
float complex csqrtf(float complex z);
double complex csqrt(double complex z);
long double complex csqrtl(long double complex z);


[Parameters]

z Complex number for which the square root is to be computed

[Return values]

Normal: Complex square root of z

Abnormal: Domain error: Returns not-a-number.

[Remarks]

A domain error occurs if z is negative.

The branch cut for the csqrt function group is along the negative real axis.

The range of the return value from the csqrt function group is the right halfplane including the imaginary axis.

 

cargf/carg/cargl

Calculates the argument.

[Format]

#include <complex.h>
float cargf(float complex z);
double carg(double complex z);
long double cargl(long double complex z);


[Parameters]

z Complex number for which the argument is to be computed

[Return values]

Argument value of z

[Remarks]

The branch cut for the carg function group is along the negative real axis.

The carg function group returns the argument in the range [, +].

 

cimagf/cimag/cimagl

Calculates the imaginary part.

[Format]

#include <complex.h>
float cimagf(float complex z);
double cimag(double complex z);
long double cimagl(long double complex z);


[Parameters]

z Complex number for which the imaginary part is to be computed

[Return values]

Imaginary part value of z as a real number

 

conjf/conj/conjl

Reverses the sign of the imaginary part of a complex number and calculates the complex conjugate.

[Format]

#include <complex.h>
float complex conjf(float complex z);
double complex conj(double complex z);
long double complex conjl(long double complex z);


[Parameters]

z Complex number for which the complex conjugate is to be computed

[Return values]

Complex conjugate of z

 

cprojf/cproj/cprojl

Calculates the projection of a complex number on the Riemann sphere.

[Format]

#include <complex.h>
float complex cprojf(float complex z);
double complex cproj(double complex z);
long double complex cprojl(long double complex z);


[Parameters]

z Complex number for which the projection on the Riemann sphere is to be computed

[Return values]

Projection of z on the Riemann sphere

 

crealf/creal/creall

Calculates the real part of a complex number.

[Format]

#include <complex.h>
float crealf(float complex z);
double creal(double complex z);
long double creall(long double complex z);


[Parameters]

z Complex number for which the real part value is to be computed

[Return values]

Real part value of z