This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

27
cppdraft/complex/h/syn.md Normal file
View File

@@ -0,0 +1,27 @@
[complex.h.syn]
# 17 Language support library [[support]](./#support)
## 17.15 C headers [[support.c.headers]](support.c.headers#complex.h.syn)
### 17.15.2 Header <complex.h> synopsis [complex.h.syn]
[🔗](#header:%3ccomplex.h%3e)
#include <complex>
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6652)
The header [<complex.h>](#header:%3ccomplex.h%3e "17.15.2Header <complex.h> synopsis[complex.h.syn]") behaves as if it simply includes the header[<complex>](complex.syn#header:%3ccomplex%3e "29.4.2Header <complex> synopsis[complex.syn]")[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6657)
[*Note [1](#note-1)*:
Names introduced by [<complex>](complex.syn#header:%3ccomplex%3e "29.4.2Header <complex> synopsis[complex.syn]") in namespace std are not placed into the global namespace scope by [<complex.h>](#header:%3ccomplex.h%3e "17.15.2Header <complex.h> synopsis[complex.h.syn]")[.](#2.sentence-1)
— *end note*]

View File

@@ -0,0 +1,53 @@
[complex.literals]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.literals)
### 29.4.11 Suffixes for complex number literals [complex.literals]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1212)
This subclause describes literal suffixes for constructing complex number literals[.](#1.sentence-1)
The suffixes i, il, and if create complex numbers of
the types complex<double>, complex<long double>, andcomplex<float> respectively, with their imaginary part denoted by the
given literal number and the real part being zero[.](#1.sentence-2)
[🔗](#lib:operator%22%22il,complex)
`constexpr complex<long double> operator""il(long double d);
constexpr complex<long double> operator""il(unsigned long long d);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1226)
*Returns*: complex<long double>{0.0L, static_cast<long double>(d)}[.](#2.sentence-1)
[🔗](#lib:operator%22%22i,complex)
`constexpr complex<double> operator""i(long double d);
constexpr complex<double> operator""i(unsigned long long d);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1238)
*Returns*: complex<double>{0.0, static_cast<double>(d)}[.](#3.sentence-1)
[🔗](#lib:operator%22%22if,complex)
`constexpr complex<float> operator""if(long double d);
constexpr complex<float> operator""if(unsigned long long d);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1250)
*Returns*: complex<float>{0.0f, static_cast<float>(d)}[.](#4.sentence-1)

View File

@@ -0,0 +1,164 @@
[complex.member.ops]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.member.ops)
### 29.4.5 Member operators [complex.member.ops]
[🔗](#lib:operator+=,complex)
`constexpr complex& operator+=(const T& rhs);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L441)
*Effects*: Adds the scalar value rhs to the real part of the complex value*this and stores the result in the real part of*this,
leaving the imaginary part unchanged[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L449)
*Returns*: *this[.](#2.sentence-1)
[🔗](#lib:operator-=,complex)
`constexpr complex& operator-=(const T& rhs);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L460)
*Effects*: Subtracts the scalar value rhs from the real part of the complex value*this and stores the result in the real part of*this,
leaving the imaginary part unchanged[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L468)
*Returns*: *this[.](#4.sentence-1)
[🔗](#lib:operator*=,complex)
`constexpr complex& operator*=(const T& rhs);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L479)
*Effects*: Multiplies the scalar value rhs by the complex value*this and stores the result in*this[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L486)
*Returns*: *this[.](#6.sentence-1)
[🔗](#lib:operator/=,complex)
`constexpr complex& operator/=(const T& rhs);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L497)
*Effects*: Divides the scalar value rhs into the complex value*this and stores the result in*this[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L504)
*Returns*: *this[.](#8.sentence-1)
[🔗](#lib:operator=,complex)
`template<class X> constexpr complex& operator=(const complex<X>& rhs);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L515)
*Effects*: Assigns the value rhs.real() to the real part and
the value rhs.imag() to the imaginary part
of the complex value *this[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L521)
*Returns*: *this[.](#10.sentence-1)
[🔗](#lib:operator+=,complex_)
`template<class X> constexpr complex& operator+=(const complex<X>& rhs);
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L532)
*Effects*: Adds the complex value rhs to the complex value*this and stores the sum in*this[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L539)
*Returns*: *this[.](#12.sentence-1)
[🔗](#lib:operator-=,complex_)
`template<class X> constexpr complex& operator-=(const complex<X>& rhs);
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L550)
*Effects*: Subtracts the complex value rhs from the complex value*this and stores the difference in*this[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L557)
*Returns*: *this[.](#14.sentence-1)
[🔗](#lib:operator*=,complex_)
`template<class X> constexpr complex& operator*=(const complex<X>& rhs);
`
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L568)
*Effects*: Multiplies the complex value rhs by the complex value*this and stores the product in*this[.](#15.sentence-1)
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L575)
*Returns*: *this[.](#16.sentence-1)
[🔗](#lib:operator/=,complex_)
`template<class X> constexpr complex& operator/=(const complex<X>& rhs);
`
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L586)
*Effects*: Divides the complex value rhs into the complex value*this and stores the quotient in*this[.](#17.sentence-1)
[18](#18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L593)
*Returns*: *this[.](#18.sentence-1)

View File

@@ -0,0 +1,80 @@
[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<class X> constexpr explicit(see below) complex(const complex<X>& 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)

1006
cppdraft/complex/numbers.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
[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>](complex.syn#header:%3ccomplex%3e "29.4.2Header <complex> 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.2Fundamental 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.1General"))[.](#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<T> then:
- [(4.1)](#4.1)
the expression reinterpret_cast<cv T(&)[2]>(z) is well-formed,
- [(4.2)](#4.2)
reinterpret_cast<cv T(&)[2]>(z)[0] designates the real part of z, and
- [(4.3)](#4.3)
reinterpret_cast<cv T(&)[2]>(z)[1] designates the imaginary part of z[.](#4.sentence-1)
Moreover, if a is an expression of type cv complex<T>* and the expression a[i] is well-defined for an integer expression i, then:
- [(4.4)](#4.4)
reinterpret_cast<cv T*>(a)[2 * i] designates the real part of a[i], and
- [(4.5)](#4.5)
reinterpret_cast<cv T*>(a)[2 * i + 1] designates the imaginary part of a[i][.](#4.sentence-2)

173
cppdraft/complex/ops.md Normal file
View File

@@ -0,0 +1,173 @@
[complex.ops]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.ops)
### 29.4.6 Non-member operations [complex.ops]
[🔗](#lib:operator+,complex)
`template<class T> constexpr complex<T> operator+(const complex<T>& lhs);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L606)
*Returns*: complex<T>(lhs)[.](#1.sentence-1)
[🔗](#itemdecl:2)
`template<class T> constexpr complex<T> operator+(const complex<T>& lhs, const complex<T>& rhs);
template<class T> constexpr complex<T> operator+(const complex<T>& lhs, const T& rhs);
template<class T> constexpr complex<T> operator+(const T& lhs, const complex<T>& rhs);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L618)
*Returns*: complex<T>(lhs) += rhs[.](#2.sentence-1)
[🔗](#lib:operator-,complex)
`template<class T> constexpr complex<T> operator-(const complex<T>& lhs);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L629)
*Returns*: complex<T>(-lhs.real(),-lhs.imag())[.](#3.sentence-1)
[🔗](#lib:operator-,complex_)
`template<class T> constexpr complex<T> operator-(const complex<T>& lhs, const complex<T>& rhs);
template<class T> constexpr complex<T> operator-(const complex<T>& lhs, const T& rhs);
template<class T> constexpr complex<T> operator-(const T& lhs, const complex<T>& rhs);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L642)
*Returns*: complex<T>(lhs) -= rhs[.](#4.sentence-1)
[🔗](#lib:operator*,complex)
`template<class T> constexpr complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs);
template<class T> constexpr complex<T> operator*(const complex<T>& lhs, const T& rhs);
template<class T> constexpr complex<T> operator*(const T& lhs, const complex<T>& rhs);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L655)
*Returns*: complex<T>(lhs) *= rhs[.](#5.sentence-1)
[🔗](#lib:operator/,complex)
`template<class T> constexpr complex<T> operator/(const complex<T>& lhs, const complex<T>& rhs);
template<class T> constexpr complex<T> operator/(const complex<T>& lhs, const T& rhs);
template<class T> constexpr complex<T> operator/(const T& lhs, const complex<T>& rhs);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L668)
*Returns*: complex<T>(lhs) /= rhs[.](#6.sentence-1)
[🔗](#lib:operator==,complex)
`template<class T> constexpr bool operator==(const complex<T>& lhs, const complex<T>& rhs);
template<class T> constexpr bool operator==(const complex<T>& lhs, const T& rhs);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L680)
*Returns*: lhs.real() == rhs.real() && lhs.imag() == rhs.imag()[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L684)
*Remarks*: The imaginary part is assumed to beT(),
or 0.0, for theT arguments[.](#8.sentence-1)
[🔗](#lib:operator%3e%3e,complex)
`template<class T, class charT, class traits>
basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& is, complex<T>& x);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L700)
*Preconditions*: The input values are convertible toT[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L705)
*Effects*: Extracts a complex number x of the form:u,(u),
or(u,v),
whereu is the real part andv is the imaginary part ([[istream.formatted]](istream.formatted "31.7.5.3Formatted input functions"))[.](#10.sentence-1)
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L718)
If bad input is encountered, callsis.setstate(ios_base::failbit) (which may throwios_base::failure ([[iostate.flags]](iostate.flags "31.5.4.4Flags functions")))[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L724)
*Returns*: is[.](#12.sentence-1)
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L728)
*Remarks*: This extraction is performed as a series of simpler
extractions[.](#13.sentence-1)
Therefore, the skipping of whitespace is specified to be
the same for each of the simpler extractions[.](#13.sentence-2)
[🔗](#lib:operator%3c%3c,complex)
`template<class T, class charT, class traits>
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
`
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L743)
*Effects*: Inserts the complex number x onto the stream o as if it were implemented as follows:basic_ostringstream<charT, traits> s;
s.flags(o.flags());
s.imbue(o.getloc());
s.precision(o.precision());
s << '(' << x.real() << ',' << x.imag() << ')';return o << s.str();
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L756)
[*Note [1](#note-1)*:
In a locale in which comma is used as a decimal point character, the
use of comma as a field separator can be ambiguous[.](#15.sentence-1)
Insertingshowpoint into the output stream forces all outputs to
show an explicit decimal point character; as a result, all inserted sequences of
complex numbers can be extracted unambiguously[.](#15.sentence-2)
— *end note*]

11
cppdraft/complex/syn.md Normal file
View File

@@ -0,0 +1,11 @@
[complex.syn]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.syn)
### 29.4.2 Header <complex> synopsis [complex.syn]
[🔗](#header:%3ccomplex%3e)
namespace std {// [[complex]](complex "29.4.3Class template complex"), class template complextemplate<class T> class complex; // [[complex.ops]](complex.ops "29.4.6Non-member operations"), operatorstemplate<class T> constexpr complex<T> operator+(const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator+(const complex<T>&, const T&); template<class T> constexpr complex<T> operator+(const T&, const complex<T>&); template<class T> constexpr complex<T> operator-(const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator-(const complex<T>&, const T&); template<class T> constexpr complex<T> operator-(const T&, const complex<T>&); template<class T> constexpr complex<T> operator*(const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator*(const complex<T>&, const T&); template<class T> constexpr complex<T> operator*(const T&, const complex<T>&); template<class T> constexpr complex<T> operator/(const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator/(const complex<T>&, const T&); template<class T> constexpr complex<T> operator/(const T&, const complex<T>&); template<class T> constexpr complex<T> operator+(const complex<T>&); template<class T> constexpr complex<T> operator-(const complex<T>&); template<class T> constexpr bool operator==(const complex<T>&, const complex<T>&); template<class T> constexpr bool operator==(const complex<T>&, const T&); template<class T, class charT, class traits> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>&, complex<T>&); template<class T, class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&, const complex<T>&); // [[complex.value.ops]](complex.value.ops "29.4.7Value operations"), valuestemplate<class T> constexpr T real(const complex<T>&); template<class T> constexpr T imag(const complex<T>&); template<class T> constexpr T abs(const complex<T>&); template<class T> constexpr T arg(const complex<T>&); template<class T> constexpr T norm(const complex<T>&); template<class T> constexpr complex<T> conj(const complex<T>&); template<class T> constexpr complex<T> proj(const complex<T>&); template<class T> constexpr complex<T> polar(const T&, const T& = T()); // [[complex.transcendentals]](complex.transcendentals "29.4.8Transcendentals"), transcendentalstemplate<class T> constexpr complex<T> acos(const complex<T>&); template<class T> constexpr complex<T> asin(const complex<T>&); template<class T> constexpr complex<T> atan(const complex<T>&); template<class T> constexpr complex<T> acosh(const complex<T>&); template<class T> constexpr complex<T> asinh(const complex<T>&); template<class T> constexpr complex<T> atanh(const complex<T>&); template<class T> constexpr complex<T> cos (const complex<T>&); template<class T> constexpr complex<T> cosh (const complex<T>&); template<class T> constexpr complex<T> exp (const complex<T>&); template<class T> constexpr complex<T> log (const complex<T>&); template<class T> constexpr complex<T> log10(const complex<T>&); template<class T> constexpr complex<T> pow (const complex<T>&, const T&); template<class T> constexpr complex<T> pow (const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> pow (const T&, const complex<T>&); template<class T> constexpr complex<T> sin (const complex<T>&); template<class T> constexpr complex<T> sinh (const complex<T>&); template<class T> constexpr complex<T> sqrt (const complex<T>&); template<class T> constexpr complex<T> tan (const complex<T>&); template<class T> constexpr complex<T> tanh (const complex<T>&); // [[complex.tuple]](complex.tuple "29.4.9Tuple interface"), tuple interfacetemplate<class T> struct tuple_size; template<size_t I, class T> struct tuple_element; template<class T> struct tuple_size<complex<T>>; template<size_t I, class T> struct tuple_element<I, complex<T>>; template<size_t I, class T>constexpr T& get(complex<T>&) noexcept; template<size_t I, class T>constexpr T&& get(complex<T>&&) noexcept; template<size_t I, class T>constexpr const T& get(const complex<T>&) noexcept; template<size_t I, class T>constexpr const T&& get(const complex<T>&&) noexcept; // [[complex.literals]](complex.literals "29.4.11Suffixes for complex number literals"), complex literalsinline namespace literals {inline namespace complex_literals {constexpr complex<long double> operator""il(long double); constexpr complex<long double> operator""il(unsigned long long); constexpr complex<double> operator""i(long double); constexpr complex<double> operator""i(unsigned long long); constexpr complex<float> operator""if(long double); constexpr complex<float> operator""if(unsigned long long); }}}

View File

@@ -0,0 +1,288 @@
[complex.transcendentals]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.transcendentals)
### 29.4.8 Transcendentals [complex.transcendentals]
[🔗](#lib:acos,complex)
`template<class T> constexpr complex<T> acos(const complex<T>& x);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L878)
*Returns*: The complex arc cosine of x[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L882)
*Remarks*: Behaves the same as the C function cacos[.](#2.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.5.1
[🔗](#lib:asin,complex)
`template<class T> constexpr complex<T> asin(const complex<T>& x);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L895)
*Returns*: The complex arc sine of x[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L899)
*Remarks*: Behaves the same as the C function casin[.](#4.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.5.2
[🔗](#lib:atan,complex)
`template<class T> constexpr complex<T> atan(const complex<T>& x);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L912)
*Returns*: The complex arc tangent of x[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L916)
*Remarks*: Behaves the same as the C function catan[.](#6.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.5.3
[🔗](#lib:acosh,complex)
`template<class T> constexpr complex<T> acosh(const complex<T>& x);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L929)
*Returns*: The complex arc hyperbolic cosine of x[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L933)
*Remarks*: Behaves the same as the C function cacosh[.](#8.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.6.1
[🔗](#lib:asinh,complex)
`template<class T> constexpr complex<T> asinh(const complex<T>& x);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L946)
*Returns*: The complex arc hyperbolic sine of x[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L950)
*Remarks*: Behaves the same as the C function casinh[.](#10.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.6.2
[🔗](#lib:atanh,complex)
`template<class T> constexpr complex<T> atanh(const complex<T>& x);
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L963)
*Returns*: The complex arc hyperbolic tangent of x[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L967)
*Remarks*: Behaves the same as the C function catanh[.](#12.sentence-1)
See also: ISO/IEC 9899:2024, 7.3.6.3
[🔗](#lib:cos,complex)
`template<class T> constexpr complex<T> cos(const complex<T>& x);
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L979)
*Returns*: The complex cosine of x[.](#13.sentence-1)
[🔗](#lib:cosh,complex)
`template<class T> constexpr complex<T> cosh(const complex<T>& x);
`
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L990)
*Returns*: The complex hyperbolic cosine of x[.](#14.sentence-1)
[🔗](#lib:exp,complex)
`template<class T> constexpr complex<T> exp(const complex<T>& x);
`
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1001)
*Returns*: The complex base-e exponential of x[.](#15.sentence-1)
[🔗](#lib:log,complex)
`template<class T> constexpr complex<T> log(const complex<T>& x);
`
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1012)
*Returns*: The complex natural (base-e) logarithm of x[.](#16.sentence-1)
For all x,imag(log(x)) lies in the interval [−π, π][.](#16.sentence-2)
[*Note [1](#note-1)*:
The semantics of this function are intended to be the same in C++
as they are for clog in C[.](#16.sentence-3)
— *end note*]
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1021)
*Remarks*: The branch cuts are along the negative real axis[.](#17.sentence-1)
[🔗](#lib:log10,complex)
`template<class T> constexpr complex<T> log10(const complex<T>& x);
`
[18](#18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1032)
*Returns*: The complex common (base-10) logarithm of x, defined aslog(x) / log(10)[.](#18.sentence-1)
[19](#19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1037)
*Remarks*: The branch cuts are along the negative real axis[.](#19.sentence-1)
[🔗](#lib:pow,complex)
`template<class T> constexpr complex<T> pow(const complex<T>& x, const complex<T>& y);
template<class T> constexpr complex<T> pow(const complex<T>& x, const T& y);
template<class T> constexpr complex<T> pow(const T& x, const complex<T>& y);
`
[20](#20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1050)
*Returns*: The complex power of base x raised to the yth power,
defined asexp(y * log(x))[.](#20.sentence-1)
The value returned forpow(0, 0) is implementation-defined[.](#20.sentence-2)
[21](#21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1059)
*Remarks*: The branch cuts are along the negative real axis[.](#21.sentence-1)
[🔗](#lib:sin,complex)
`template<class T> constexpr complex<T> sin(const complex<T>& x);
`
[22](#22)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1070)
*Returns*: The complex sine of x[.](#22.sentence-1)
[🔗](#lib:sinh,complex)
`template<class T> constexpr complex<T> sinh(const complex<T>& x);
`
[23](#23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1081)
*Returns*: The complex hyperbolic sine of x[.](#23.sentence-1)
[🔗](#lib:sqrt,complex)
`template<class T> constexpr complex<T> sqrt(const complex<T>& x);
`
[24](#24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1092)
*Returns*: The complex square root of x, in the range of the right
half-plane[.](#24.sentence-1)
[*Note [2](#note-2)*:
The semantics of this function are intended to be the same in C++
as they are for csqrt in C[.](#24.sentence-2)
— *end note*]
[25](#25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1101)
*Remarks*: The branch cuts are along the negative real axis[.](#25.sentence-1)
[🔗](#lib:tan,complex)
`template<class T> constexpr complex<T> tan(const complex<T>& x);
`
[26](#26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1112)
*Returns*: The complex tangent of x[.](#26.sentence-1)
[🔗](#lib:tanh,complex)
`template<class T> constexpr complex<T> tanh(const complex<T>& x);
`
[27](#27)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1123)
*Returns*: The complex hyperbolic tangent of x[.](#27.sentence-1)

49
cppdraft/complex/tuple.md Normal file
View File

@@ -0,0 +1,49 @@
[complex.tuple]
# 29 Numerics library [[numerics]](./#numerics)
## 29.4 Complex numbers [[complex.numbers]](complex.numbers#complex.tuple)
### 29.4.9 Tuple interface [complex.tuple]
[🔗](#lib:tuple_size)
`template<class T>
struct tuple_size<complex<T>> : integral_constant<size_t, 2> {};
template<size_t I, class T>
struct tuple_element<I, complex<T>> {
using type = T;
};
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1143)
*Mandates*: I < 2 is true[.](#1.sentence-1)
[🔗](#lib:get,complex)
`template<size_t I, class T>
constexpr T& get(complex<T>& z) noexcept;
template<size_t I, class T>
constexpr T&& get(complex<T>&& z) noexcept;
template<size_t I, class T>
constexpr const T& get(const complex<T>& z) noexcept;
template<size_t I, class T>
constexpr const T&& get(const complex<T>&& z) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1161)
*Mandates*: I < 2 is true[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L1165)
*Returns*: A reference to the real part of z if I == 0 is true,
otherwise a reference to the imaginary part of z[.](#3.sentence-1)

View File

@@ -0,0 +1,113 @@
[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)