Namespaces
Variants
Views
Actions

Complex number arithmetic

From cppreference.com

The header <complex.h> defines macros and declares functions that support complex number arithmetic. Complex values are values of type double complex, float complex, long double complex,

If the macro constant __STDC_IEC_559_COMPLEX__(C99) is defined by the compiler, in addition to the complex types, the imaginary types are also supported: double imaginary, float imaginary, and long double imaginary. When a value of imaginary type is converted to a value of complex type, the resulting complex type has its real component set to zero. When a value of complex type is converted to a value of imaginary type, the real component is discarded.

Standard arithmetic operators +, -, *, / can be used with real, complex, and imaginary types in any combination.

If the macro constant __STDC_NO_COMPLEX__(C11) is defined by the compiler, the header <complex.h> and all of the names listed here are not provided.

If #pragma STDC CX_LIMITED_RANGE on is used, complex multiplication, division, and absolute value may use simplified mathematical formulas, despite the possibility of intermediate overflow.

Defined in header <complex.h>
complex type macro
(macro constant)
the complex unit constant i
(macro constant)
imaginary type macro
(macro constant)
the imaginary unit constant i
(macro constant)
(C99)
the complex or imaginary unit constant i
(macro constant)
constructs a complex number from real and imaginary parts
(function macro)
computes the complex arc cosine
(function)
computes the complex arc sine
(function)
computes the complex arc tangent
(function)
computes the complex cosine
(function)
computes the complex sine
(function)
computes the complex tangent
(function)
computes the complex arc hyperbolic cosine
(function)
computes the complex arc hyperbolic sine
(function)
computes the complex arc hyperbolic tangent
(function)
computes the complex hyperbolic cosine
(function)
computes the complex hyperbolic sine
(function)
computes the complex hyperbolic tangent
(function)
computes the complex base-e exponential
(function)
computes the complex natural logarithm
(function)
computes the magnitude of a complex number
(function)
computes the complex power function
(function)
computes the complex square root
(function)
computes the imaginary part a complex number
(function)
computes the real part of a complex number
(function)
computes the phase angle of a complex number
(function)
computes the complex conjugate
(function)
computes the projection on Riemann sphere
(function)