Complex number arithmetic
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.