[complex.value.ops]

# 29 Numerics library [[numerics]](./#numerics)

## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.value.ops)

### 29.4.7 Value operations [complex.value.ops]

[ð](#lib:real,complex)

`template<class T> constexpr T real(const complex<T>& x);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L774)

*Returns*: x.real()[.](#1.sentence-1)

[ð](#lib:imag,complex)

`template<class T> constexpr T imag(const complex<T>& x);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L785)

*Returns*: x.imag()[.](#2.sentence-1)

[ð](#lib:abs,complex)

`template<class T> constexpr T abs(const complex<T>& x);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L796)

*Returns*: The magnitude of x[.](#3.sentence-1)

[ð](#lib:arg,complex)

`template<class T> constexpr T arg(const complex<T>& x);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L807)

*Returns*: The phase angle of x, or atan2(imag(x), real(x))[.](#4.sentence-1)

[ð](#lib:norm,complex)

`template<class T> constexpr T norm(const complex<T>& x);
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L818)

*Returns*: The squared magnitude of x[.](#5.sentence-1)

[ð](#lib:conj,complex)

`template<class T> constexpr complex<T> conj(const complex<T>& x);
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L829)

*Returns*: The complex conjugate of x[.](#6.sentence-1)

[ð](#lib:proj,complex)

`template<class T> constexpr complex<T> proj(const complex<T>& x);
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L840)

*Returns*: The projection of x onto the Riemann sphere[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L844)

*Remarks*: Behaves the same as the C function cproj[.](#8.sentence-1)

See also: ISO/IEC 9899:2024, 7.3.9.5

[ð](#lib:polar,complex)

`template<class T> constexpr complex<T> polar(const T& rho, const T& theta = T());
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L856)

*Preconditions*: rho is non-negative and non-NaN[.](#9.sentence-1)

theta is finite[.](#9.sentence-2)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L860)

*Returns*: Thecomplex value corresponding
to a complex number whose magnitude is rho and whose phase angle
is theta[.](#10.sentence-1)
