[complex.members] # 29 Numerics library [[numerics]](./#numerics) ## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.members) ### 29.4.4 Member functions [complex.members] [🔗](#lib:complex,constructor) `constexpr complex(const T& re = T(), const T& im = T()); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L366) *Postconditions*: real() == re && imag() == im is true[.](#1.sentence-1) [🔗](#lib:complex,constructor_) `template constexpr explicit(see below) complex(const complex& other); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L377) *Effects*: Initializes the real part with other.real() and the imaginary part with other.imag()[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L382) *Remarks*: The expression inside explicit evaluates to false if and only if the floating-point conversion rank of T is greater than or equal to the floating-point conversion rank of X[.](#3.sentence-1) [🔗](#lib:real,complex) `constexpr T real() const; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L395) *Returns*: The value of the real component[.](#4.sentence-1) [🔗](#lib:real,complex_) `constexpr void real(T val); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L406) *Effects*: Assigns val to the real component[.](#5.sentence-1) [🔗](#lib:imag,complex) `constexpr T imag() const; ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L417) *Returns*: The value of the imaginary component[.](#6.sentence-1) [🔗](#lib:imag,complex_) `constexpr void imag(T val); ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L428) *Effects*: Assigns val to the imaginary component[.](#7.sentence-1)