Заголовочный файл стандартной библиотеки <complex>
Материал из cppreference.com
Этот заголовок является частью numeric библиотеки.
Содержание |
[править]Классы
a complex number type (шаблон класса) | |
a complex number type (специализация шаблона класса) |
[править]Функции
Операции | |
применяет унарные операторы к комплексным числам (шаблон функции) | |
выполняет арифметику комплексных чисел над двумя комплексными значениями или комплексным и скалярным значениями (шаблон функции) | |
(удалено в C++20) | сравнивает два комплексных числа или комплексное и скалярное числа (шаблон функции) |
сериализует и десериализует комплексное число (шаблон функции) | |
возвращает действительную часть (шаблон функции) | |
возвращает мнимую часть (шаблон функции) | |
возвращает величину комплексного числа (шаблон функции) | |
возвращает угол фазы (шаблон функции) | |
возвращает квадрат величины (шаблон функции) | |
возвращает комплексное сопряжение (шаблон функции) | |
(C++11) | возвращает проекцию на сферу Римана (шаблон функции) |
создаёт комплексное число из величины и угла фазы (шаблон функции) | |
Экспоненциальные функции | |
комплексная экспонента по основанию e (шаблон функции) | |
комплексный натуральный логарифм с ветвью, обрезанной по отрицательной действительной оси (шаблон функции) | |
комплексный десятичный логарифм с ветвью, обрезанной по отрицательной действительной оси (шаблон функции) | |
Степенные функции | |
комплексная степень, один или оба аргумента могут быть комплексным числом (шаблон функции) | |
комплексный квадратный корень из диапазона правой полуплоскости (шаблон функции) | |
Тригонометрические функции | |
вычисляет синус комплексного числа (sin(z)) (шаблон функции) | |
вычисляет косинус комплексного числа (cos(z)) (шаблон функции) | |
вычисляет тангенс комплексного числа (tan(z)) (шаблон функции) | |
(C++11) | вычисляет арксинус комплексного числа (arcsin(z)) (шаблон функции) |
(C++11) | вычисляет арккосинус комплексного числа (arccos(z)) (шаблон функции) |
(C++11) | вычисляет арктангенс комплексного числа (arctan(z)) (шаблон функции) |
Гиперболические функции | |
вычисляет гиперболический синус комплексного числа (sinh(z)) (шаблон функции) | |
вычисляет гиперболический косинус комплексного числа (cosh(z)) (шаблон функции) | |
вычисляет гиперболический тангенс комплексного числа (tanh(z)) (шаблон функции) | |
(C++11) | вычисляет гиперболический синус площади комплексного числа (arsinh(z)) (шаблон функции) |
(C++11) | вычисляет гиперболический косинус площади комплексного числа (arcosh(z)) (шаблон функции) |
(C++11) | вычисляет гиперболический тангенс площади комплексного числа (artanh(z)) (шаблон функции) |
Литералы | |
литерал std::complex, представляющий чисто мнимое число (функция) |
[править]Краткое содержание
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>&); // 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);}}}
[править]Класс std::complex
template<class T>class complex {public:typedef T value_type;constexpr complex(const T& re = T(), const T& im = T());constexpr complex(const complex&);template<class X>constexpr 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>&);};
[править]std::complex специализации
template<>class complex<float>{public:typedeffloat value_type; constexpr complex(float re =0.0f, float im =0.0f);explicitconstexpr complex(const complex<double>&);explicitconstexpr complex(const complex<longdouble>&); constexprfloat real()const;constexprvoid real(float);constexprfloat imag()const;constexprvoid imag(float); constexpr complex<float>& operator=(float);constexpr complex<float>& operator+=(float);constexpr complex<float>& operator-=(float);constexpr complex<float>& operator*=(float);constexpr complex<float>& operator/=(float); constexpr complex<float>& operator=(const complex<float>&);template<class X>constexpr complex<float>& operator=(const complex<X>&);template<class X>constexpr complex<float>& operator+=(const complex<X>&);template<class X>constexpr complex<float>& operator-=(const complex<X>&);template<class X>constexpr complex<float>& operator*=(const complex<X>&);template<class X>constexpr complex<float>& operator/=(const complex<X>&);}; template<>class complex<double>{public:typedefdouble value_type; constexpr complex(double re =0.0, double im =0.0);constexpr complex(const complex<float>&);explicitconstexpr complex(const complex<longdouble>&); constexprdouble real()const;constexprvoid real(double);constexprdouble imag()const;constexprvoid imag(double); constexpr complex<double>& operator=(double);constexpr complex<double>& operator+=(double);constexpr complex<double>& operator-=(double);constexpr complex<double>& operator*=(double);constexpr complex<double>& operator/=(double); constexpr complex<double>& operator=(const complex<double>&);template<class X>constexpr complex<double>& operator=(const complex<X>&);template<class X>constexpr complex<double>& operator+=(const complex<X>&);template<class X>constexpr complex<double>& operator-=(const complex<X>&);template<class X>constexpr complex<double>& operator*=(const complex<X>&);template<class X>constexpr complex<double>& operator/=(const complex<X>&);}; template<>class complex<longdouble>{public:typedeflongdouble value_type; constexpr complex(longdouble re = 0.0L, longdouble im = 0.0L);constexpr complex(const complex<float>&);constexpr complex(const complex<double>&); constexprlongdouble real()const;constexprvoid real(longdouble);constexprlongdouble imag()const;constexprvoid imag(longdouble); constexpr complex<longdouble>& operator=(const complex<longdouble>&);constexpr complex<longdouble>& operator=(longdouble);constexpr complex<longdouble>& operator+=(longdouble);constexpr complex<longdouble>& operator-=(longdouble);constexpr complex<longdouble>& operator*=(longdouble);constexpr complex<longdouble>& operator/=(longdouble); template<class X>constexpr complex<longdouble>& operator=(const complex<X>&);template<class X>constexpr complex<longdouble>& operator+=(const complex<X>&);template<class X>constexpr complex<longdouble>& operator-=(const complex<X>&);template<class X>constexpr complex<longdouble>& operator*=(const complex<X>&);template<class X>constexpr complex<longdouble>& operator/=(const complex<X>&);};
[править]Отчеты об ошибках
Следующие изменения поведения были применены с обратной силой к ранее опубликованным стандартам C++:
Номер | Применён | Поведение в стандарте | Корректное поведение |
---|---|---|---|
LWG 79 | C++98 | the default argument of the second parameter of polar was missing in the synopsis | added |