This header is part of thenumeric library.
Contents |
a complex number type (class template) |
Operations | |
applies unary operators to complex numbers (function template)[edit] | |
performs complex number arithmetic on two complex values or a complex and a scalar (function template)[edit] | |
(removed in C++20) | compares two complex numbers or a complex and a scalar (function template)[edit] |
serializes and deserializes a complex number (function template)[edit] | |
returns the real part (function template)[edit] | |
returns the imaginary part (function template)[edit] | |
returns the magnitude of a complex number (function template)[edit] | |
returns the phase angle (function template)[edit] | |
returns the squared magnitude (function template)[edit] | |
returns the complex conjugate (function template)[edit] | |
(C++11) | returns the projection onto the Riemann sphere (function template)[edit] |
constructs a complex number from magnitude and phase angle (function template)[edit] | |
Exponential functions | |
complex basee exponential (function template)[edit] | |
complex natural logarithm with the branch cuts along the negative real axis (function template)[edit] | |
complex common logarithm with the branch cuts along the negative real axis (function template)[edit] | |
Power functions | |
complex power, one or both arguments may be a complex number (function template)[edit] | |
complex square root in the range of the right half-plane (function template)[edit] | |
Trigonometric functions | |
computes sine of a complex number (\({\small\sin{z}}\)sin(z)) (function template)[edit] | |
computes cosine of a complex number (\({\small\cos{z}}\)cos(z)) (function template)[edit] | |
computes tangent of a complex number (\({\small\tan{z}}\)tan(z)) (function template)[edit] | |
(C++11) | computes arc sine of a complex number (\({\small\arcsin{z}}\)arcsin(z)) (function template)[edit] |
(C++11) | computes arc cosine of a complex number (\({\small\arccos{z}}\)arccos(z)) (function template)[edit] |
(C++11) | computes arc tangent of a complex number (\({\small\arctan{z}}\)arctan(z)) (function template)[edit] |
Hyperbolic functions | |
computes hyperbolic sine of a complex number (\({\small\sinh{z}}\)sinh(z)) (function template)[edit] | |
computes hyperbolic cosine of a complex number (\({\small\cosh{z}}\)cosh(z)) (function template)[edit] | |
computes hyperbolic tangent of a complex number (\({\small\tanh{z}}\)tanh(z)) (function template)[edit] | |
(C++11) | computes area hyperbolic sine of a complex number (\({\small\operatorname{arsinh}{z}}\)arsinh(z)) (function template)[edit] |
(C++11) | computes area hyperbolic cosine of a complex number (\({\small\operatorname{arcosh}{z}}\)arcosh(z)) (function template)[edit] |
(C++11) | computes area hyperbolic tangent of a complex number (\({\small\operatorname{artanh}{z}}\)artanh(z)) (function template)[edit] |
Literals | |
astd::complex literal representing purely imaginary number (function)[edit] |
namespace std{template<class T>class complex; template<>class complex<float>;template<>class complex<double>;template<>class complex<longdouble>; // operators: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>&,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>constexprbool operator==(const complex<T>&,const complex<T>&);template<class T>constexprbool operator==(const complex<T>&,const T&);template<class T>constexprbool operator==(const T&,const complex<T>&); template<class T>constexprbool operator!=(const complex<T>&,const complex<T>&);template<class T>constexprbool operator!=(const complex<T>&,const T&);template<class T>constexprbool operator!=(const T&,const complex<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>&); // values:template<class T>constexpr T real(const complex<T>&);template<class T>constexpr T imag(const complex<T>&); template<class T> T abs(const complex<T>&);template<class T> 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> complex<T> proj(const complex<T>&);template<class T> complex<T> polar(const T&,const T&=0); // transcendentals:template<class T> complex<T> acos(const complex<T>&);template<class T> complex<T> asin(const complex<T>&);template<class T> complex<T> atan(const complex<T>&); template<class T> complex<T> acosh(const complex<T>&);template<class T> complex<T> asinh(const complex<T>&);template<class T> complex<T> atanh(const complex<T>&); template<class T> complex<T> cos(const complex<T>&);template<class T> complex<T> cosh(const complex<T>&);template<class T> complex<T> exp(const complex<T>&);template<class T> complex<T> log(const complex<T>&);template<class T> complex<T> log10(const complex<T>&); template<class T> complex<T> pow(const complex<T>&,const T&);template<class T> complex<T> pow(const complex<T>&,const complex<T>&);template<class T> complex<T> pow(const T&,const complex<T>&); template<class T> complex<T> sin(const complex<T>&);template<class T> complex<T> sinh(const complex<T>&);template<class T> complex<T> sqrt(const complex<T>&);template<class T> complex<T> tan(const complex<T>&);template<class T> complex<T> tanh(const complex<T>&); // tuple interface:template<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>constexprconst T& get(const complex<T>&)noexcept;template<size_t I,class T>constexprconst T&& get(const complex<T>&&)noexcept; // complex literals:inlinenamespace literals{inlinenamespace complex_literals{constexpr complex<longdouble> operator""il(longdouble);constexpr complex<longdouble> operator""il(unsignedlonglong);constexpr complex<double> operator""i(longdouble);constexpr complex<double> operator""i(unsignedlonglong);constexpr complex<float> operator""if(longdouble);constexpr complex<float> operator""if(unsignedlonglong);}}}
template<class T>class complex{public:typedef T value_type;constexpr complex(const T& re= T(),const T& im= T());constexpr complex(const complex&)=default;template<class X>constexprexplicit(/* see constructor page */) complex(const complex<X>&); constexpr T real()const;constexprvoid real(T);constexpr T imag()const;constexprvoid imag(T); constexpr complex<T>& operator=(const T&);constexpr complex<T>& operator+=(const T&);constexpr complex<T>& operator-=(const T&);constexpr complex<T>& operator*=(const T&);constexpr complex<T>& operator/=(const T&); constexpr complex& operator=(const complex&);template<class X>constexpr complex<T>& operator=(const complex<X>&);template<class X>constexpr complex<T>& operator+=(const complex<X>&);template<class X>constexpr complex<T>& operator-=(const complex<X>&);template<class X>constexpr complex<T>& operator*=(const complex<X>&);template<class X>constexpr complex<T>& operator/=(const complex<X>&);};
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 79 | C++98 | the default argument of the second parameter ofpolar was missing in the synopsis | added |