[complex.numbers.general] # 29 Numerics library [[numerics]](./#numerics) ## 29.4 Complex numbers [[complex.numbers]](complex.numbers#general) ### 29.4.1 General [complex.numbers.general] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L180) The header [](complex.syn#header:%3ccomplex%3e "29.4.2 Header synopsis [complex.syn]") defines a class template, and numerous functions for representing and manipulating complex numbers[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L184) The effect of instantiating the primary template of complex for any type that is not a cv-unqualified floating-point type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types")) is unspecified[.](#2.sentence-1) Specializations of complex for cv-unqualified floating-point types are trivially copyable literal types ([[basic.types.general]](basic.types.general#term.literal.type "6.9.1 General"))[.](#2.sentence-2) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L191) If the result of a function is not mathematically defined or not in the range of representable values for its type, the behavior is undefined[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L196) If z is an lvalue of type cv complex then: - [(4.1)](#4.1) the expression reinterpret_cast(z) is well-formed, - [(4.2)](#4.2) reinterpret_cast(z)[0] designates the real part of z, and - [(4.3)](#4.3) reinterpret_cast(z)[1] designates the imaginary part of z[.](#4.sentence-1) Moreover, if a is an expression of type cv complex* and the expression a[i] is well-defined for an integer expression i, then: - [(4.4)](#4.4) reinterpret_cast(a)[2 * i] designates the real part of a[i], and - [(4.5)](#4.5) reinterpret_cast(a)[2 * i + 1] designates the imaginary part of a[i][.](#4.sentence-2)