C Programming/complex.h

Summary
complex.h is a header file that defines functionality for complex arithmetic. These functions use the built-in type  which was introduced with the C99 revision of C.

This header should not be confused with the C++ standard library header, which implements complex numbers in a completely different way (as a template class,  ).

Macros
Universal macro:
 * complex - alias of _Complex
 * _Complex_I - constant, which has type "const float _Complex" and value of imaginary unit I, I*I=-1

Defined only for `C99 Annex G`-compatible compiler modes - native support of imaginary types (it is very rare because Annex G is mathematically incorrect ):
 * imaginary - alias of _Imaginary
 * _Imaginary_I Expands to a constant expression of type const float _Imaginary with the value of the imaginary unit.

Universal alias of I:
 * I - alias of _Imaginary_I if it is defined else - alias of _Complex_I

Application may undefine complex, imaginary, and I macros if they interfere with internal values.

Functions Overview
Each function declared in  has three versions, each of which works with a different floating-point type (,   and  ). Only the  version of each function is listed here; to use the   (or  ) version, append an   (or an , respectively) to the function's name (e.g.,   and  ).

Note that all angles are in radians.


 * Basic operations


 * Exponentiation operations


 * Trigonometric operations


 * Hyperbolic operations