45 lines
1.3 KiB
Markdown
45 lines
1.3 KiB
Markdown
[cmplx.over]
|
|
|
|
# 29 Numerics library [[numerics]](./#numerics)
|
|
|
|
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#cmplx.over)
|
|
|
|
### 29.4.10 Additional overloads [cmplx.over]
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1173)
|
|
|
|
The following function templates have additional constexpr overloads:arg norm
|
|
conj proj
|
|
imag real
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1186)
|
|
|
|
The additional constexpr overloads are sufficient to ensure:
|
|
|
|
- [(2.1)](#2.1)
|
|
|
|
If the argument has a floating-point type T,
|
|
then it is effectively cast to complex<T>[.](#2.1.sentence-1)
|
|
|
|
- [(2.2)](#2.2)
|
|
|
|
Otherwise, if the argument has integer type,
|
|
then it is effectively cast to complex<double>[.](#2.2.sentence-1)
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1198)
|
|
|
|
Function template pow has additional constexpr overloads sufficient to ensure,
|
|
for a call with one argument of type complex<T1> and
|
|
the other argument of type T2 or complex<T2>,
|
|
both arguments are effectively cast to complex<common_type_t<T1, T3>>,
|
|
where T3 isdouble if T2 is an integer type and T2 otherwise[.](#3.sentence-1)
|
|
|
|
If common_type_t<T1, T3> is not well-formed,
|
|
then the program is ill-formed[.](#3.sentence-2)
|