# Complex number arithmetic

C
 Language Standard Library Type support Dynamic memory management Error handling Program utilities Date and time utilities Strings library Algorithms Numerics Input/output support Localization support Thread support (C11) Atomic operations (C11)

Numerics
 Common mathematical functions Floating-point environment Complex number arithmetics Random number generation Type-generic math

Complex number arithmetic
Types and the imaginary constant
 complex
 Complex_I
 CMPLX
 imaginary
 Imaginary_I
 I
Manipulation
 cimag
 creal
 carg
 conj
 cproj
Power and exponential functions
 cexp
 clog
 cpow
 csqrt
Trigonometric functions
 ccos
 csin
 ctan
 cacos
 casin
 catan
Hyperbolic functions
 ccosh
 csinh
 ctanh
 cacosh
 casinh
 catanh

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>`

## Contents

##### Types
(C99)
complex type macro
(macro constant)
(C99)
the complex unit constant i
(macro constant)
##### The imaginary constant
(C99)
imaginary type macro
(macro constant)
the imaginary unit constant i
(macro constant)
(C99)
the complex or imaginary unit constant i
(macro constant)
##### Manipulation
(C11)
(C11)
(C11)
constructs a complex number from real and imaginary parts
(function macro)
(C99)
(C99)
(C99)
computes the imaginary part a complex number
(function)
(C99)
(C99)
(C99)
computes the real part of a complex number
(function)
(C99)
(C99)
(C99)
computes the phase angle of a complex number
(function)
(C99)
(C99)
(C99)
computes the complex conjugate
(function)
(C99)
(C99)
(C99)
computes the projection on Riemann sphere
(function)
(C99)
(C99)
(C99)
computes the magnitude of a complex number
(function)
##### Exponential functinos
(C99)
(C99)
(C99)
computes the complex base-e exponential
(function)
(C99)
(C99)
(C99)
computes the complex natural logarithm
(function)
##### Power functions
(C99)
(C99)
(C99)
computes the complex power function
(function)
(C99)
(C99)
(C99)
computes the complex square root
(function)
##### Trigonometric functions
(C99)
(C99)
(C99)
computes the complex arc cosine
(function)
(C99)
(C99)
(C99)
computes the complex arc sine
(function)
(C99)
(C99)
(C99)
computes the complex arc tangent
(function)
(C99)
(C99)
(C99)
computes the complex cosine
(function)
(C99)
(C99)
(C99)
computes the complex sine
(function)
(C99)
(C99)
(C99)
computes the complex tangent
(function)
##### Hyperbolic functions
(C99)
(C99)
(C99)
computes the complex arc hyperbolic cosine
(function)
(C99)
(C99)
(C99)
computes the complex arc hyperbolic sine
(function)
(C99)
(C99)
(C99)
computes the complex arc hyperbolic tangent
(function)
(C99)
(C99)
(C99)
computes the complex hyperbolic cosine
(function)
(C99)
(C99)
(C99)
computes the complex hyperbolic sine
(function)
(C99)
(C99)
(C99)
computes the complex hyperbolic tangent
(function)