Lines Matching full:complex

14     complex synopsis
20 class complex
25 complex(const T& re = T(), const T& im = T()); // constexpr in C++14
26 complex(const complex&); // constexpr in C++14
27 template<class X> complex(const complex<X>&); // constexpr in C++14
35 complex<T>& operator= (const T&); // constexpr in C++20
36 complex<T>& operator+=(const T&); // constexpr in C++20
37 complex<T>& operator-=(const T&); // constexpr in C++20
38 complex<T>& operator*=(const T&); // constexpr in C++20
39 complex<T>& operator/=(const T&); // constexpr in C++20
41 complex& operator=(const complex&); // constexpr in C++20
42 template<class X> complex<T>& operator= (const complex<X>&); // constexpr in C++20
43 template<class X> complex<T>& operator+=(const complex<X>&); // constexpr in C++20
44 template<class X> complex<T>& operator-=(const complex<X>&); // constexpr in C++20
45 template<class X> complex<T>& operator*=(const complex<X>&); // constexpr in C++20
46 template<class X> complex<T>& operator/=(const complex<X>&); // constexpr in C++20
50 class complex<float>
55 constexpr complex(float re = 0.0f, float im = 0.0f);
56 explicit constexpr complex(const complex<double>&);
57 explicit constexpr complex(const complex<long double>&);
64 complex<float>& operator= (float); // constexpr in C++20
65 complex<float>& operator+=(float); // constexpr in C++20
66 complex<float>& operator-=(float); // constexpr in C++20
67 complex<float>& operator*=(float); // constexpr in C++20
68 complex<float>& operator/=(float); // constexpr in C++20
70 complex<float>& operator=(const complex<float>&); // constexpr in C++20
71 template<class X> complex<float>& operator= (const complex<X>&); // constexpr in C++20
72 template<class X> complex<float>& operator+=(const complex<X>&); // constexpr in C++20
73 template<class X> complex<float>& operator-=(const complex<X>&); // constexpr in C++20
74 template<class X> complex<float>& operator*=(const complex<X>&); // constexpr in C++20
75 template<class X> complex<float>& operator/=(const complex<X>&); // constexpr in C++20
79 class complex<double>
84 constexpr complex(double re = 0.0, double im = 0.0);
85 constexpr complex(const complex<float>&);
86 explicit constexpr complex(const complex<long double>&);
93 complex<double>& operator= (double); // constexpr in C++20
94 complex<double>& operator+=(double); // constexpr in C++20
95 complex<double>& operator-=(double); // constexpr in C++20
96 complex<double>& operator*=(double); // constexpr in C++20
97 complex<double>& operator/=(double); // constexpr in C++20
98 complex<double>& operator=(const complex<double>&); // constexpr in C++20
100 template<class X> complex<double>& operator= (const complex<X>&); // constexpr in C++20
101 template<class X> complex<double>& operator+=(const complex<X>&); // constexpr in C++20
102 template<class X> complex<double>& operator-=(const complex<X>&); // constexpr in C++20
103 template<class X> complex<double>& operator*=(const complex<X>&); // constexpr in C++20
104 template<class X> complex<double>& operator/=(const complex<X>&); // constexpr in C++20
108 class complex<long double>
113 constexpr complex(long double re = 0.0L, long double im = 0.0L);
114 constexpr complex(const complex<float>&);
115 constexpr complex(const complex<double>&);
122 complex<long double>& operator=(const complex<long double>&); // constexpr in C++20
123 complex<long double>& operator= (long double); // constexpr in C++20
124 complex<long double>& operator+=(long double); // constexpr in C++20
125 complex<long double>& operator-=(long double); // constexpr in C++20
126 complex<long double>& operator*=(long double); // constexpr in C++20
127 complex<long double>& operator/=(long double); // constexpr in C++20
129 template<class X> complex<long double>& operator= (const complex<X>&); // constexpr in C++20
130 template<class X> complex<long double>& operator+=(const complex<X>&); // constexpr in C++20
131 template<class X> complex<long double>& operator-=(const complex<X>&); // constexpr in C++20
132 template<class X> complex<long double>& operator*=(const complex<X>&); // constexpr in C++20
133 template<class X> complex<long double>& operator/=(const complex<X>&); // constexpr in C++20
137 template<class T> complex<T> operator+(const complex<T>&, const complex<T>&); // constexpr in C++20
138 template<class T> complex<T> operator+(const complex<T>&, const T&); // constexpr in C++20
139 template<class T> complex<T> operator+(const T&, const complex<T>&); // constexpr in C++20
140 template<class T> complex<T> operator-(const complex<T>&, const complex<T>&); // constexpr in C++20
141 template<class T> complex<T> operator-(const complex<T>&, const T&); // constexpr in C++20
142 template<class T> complex<T> operator-(const T&, const complex<T>&); // constexpr in C++20
143 template<class T> complex<T> operator*(const complex<T>&, const complex<T>&); // constexpr in C++20
144 template<class T> complex<T> operator*(const complex<T>&, const T&); // constexpr in C++20
145 template<class T> complex<T> operator*(const T&, const complex<T>&); // constexpr in C++20
146 template<class T> complex<T> operator/(const complex<T>&, const complex<T>&); // constexpr in C++20
147 template<class T> complex<T> operator/(const complex<T>&, const T&); // constexpr in C++20
148 template<class T> complex<T> operator/(const T&, const complex<T>&); // constexpr in C++20
149 template<class T> complex<T> operator+(const complex<T>&); // constexpr in C++20
150 template<class T> complex<T> operator-(const complex<T>&); // constexpr in C++20
151 template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
152 template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
153 template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14…
154 template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14…
155 template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14…
156 template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14…
160 operator>>(basic_istream<charT, traits>&, complex<T>&);
163 operator<<(basic_ostream<charT, traits>&, const complex<T>&);
167 template<class T> T real(const complex<T>&); // constexpr in C++14
173 template<class T> T imag(const complex<T>&); // constexpr in C++14
179 template<class T> T abs(const complex<T>&);
181 template<class T> T arg(const complex<T>&);
187 template<class T> T norm(const complex<T>&); // constexpr in C++20
193 template<class T> complex<T> conj(const complex<T>&); // constexpr in C++20
194 complex<long double> conj(long double); // constexpr in C++20
195 complex<double> conj(double); // constexpr in C++20
196 template<Integral T> complex<double> conj(T); // constexpr in C++20
197 complex<float> conj(float); // constexpr in C++20
199 template<class T> complex<T> proj(const complex<T>&);
200 complex<long double> proj(long double);
201 complex<double> proj(double);
202 template<Integral T> complex<double> proj(T);
203 complex<float> proj(float);
205 template<class T> complex<T> polar(const T&, const T& = T());
208 template<class T> complex<T> acos(const complex<T>&);
209 template<class T> complex<T> asin(const complex<T>&);
210 template<class T> complex<T> atan(const complex<T>&);
211 template<class T> complex<T> acosh(const complex<T>&);
212 template<class T> complex<T> asinh(const complex<T>&);
213 template<class T> complex<T> atanh(const complex<T>&);
214 template<class T> complex<T> cos (const complex<T>&);
215 template<class T> complex<T> cosh (const complex<T>&);
216 template<class T> complex<T> exp (const complex<T>&);
217 template<class T> complex<T> log (const complex<T>&);
218 template<class T> complex<T> log10(const complex<T>&);
220 template<class T> complex<T> pow(const complex<T>&, const T&);
221 template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
222 template<class T> complex<T> pow(const T&, const complex<T>&);
224 template<class T> complex<T> sin (const complex<T>&);
225 template<class T> complex<T> sinh (const complex<T>&);
226 template<class T> complex<T> sqrt (const complex<T>&);
227 template<class T> complex<T> tan (const complex<T>&);
228 template<class T> complex<T> tanh (const complex<T>&);
230 // [complex.tuple], tuple interface
233 template<class T> struct tuple_size<complex<T>>; // Since C++26
234 template<size_t I, class T> struct tuple_element<I, complex<T>>; // Since C++26
236 constexpr T& get(complex<T>&) noexcept; // Since C++26
238 constexpr T&& get(complex<T>&&) noexcept; // Since C++26
240 constexpr const T& get(const complex<T>&) noexcept; // Since C++26
242 constexpr const T&& get(const complex<T>&&) noexcept; // Since C++26
244 // [complex.literals], complex literals
247 constexpr complex<long double> operator""il(long double); // Since C++14
248 constexpr complex<long double> operator""il(unsigned long long); // Since C++14
249 constexpr complex<double> operator""i(long double); // Since C++14
250 constexpr complex<double> operator""i(unsigned long long); // Since C++14
251 constexpr complex<float> operator""if(long double); // Since C++14
252 constexpr complex<float> operator""if(unsigned long long); // Since C++14
260 #include <__fwd/complex.h>
283 class _LIBCPP_TEMPLATE_VIS complex;
286 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
287 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
290 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
291 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
294 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
295 operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
298 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
299 operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
302 class _LIBCPP_TEMPLATE_VIS complex {
312 complex(const value_type& __re = value_type(), const value_type& __im = value_type())
315 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 complex(const complex<_Xp>& __c)
324 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const value_type& __re) {
329 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {
333 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {
337 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {
342 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {
349 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
355 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
361 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
367 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
368 *this = *this * complex(__c.real(), __c.imag());
372 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
373 *this = *this / complex(__c.real(), __c.imag());
379 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept;
382 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept;
385 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept;
388 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept;
393 class _LIBCPP_TEMPLATE_VIS complex<double>;
395 class _LIBCPP_TEMPLATE_VIS complex<long double>;
415 class _LIBCPP_TEMPLATE_VIS complex<float> {
422 …_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re…
425 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex float __v)
428 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
429 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
443 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(float __re) {
448 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {
452 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {
456 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {
461 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {
468 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
474 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
480 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
486 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
487 *this = *this * complex(__c.real(), __c.imag());
491 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
492 *this = *this / complex(__c.real(), __c.imag());
498 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept;
501 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept;
504 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept;
507 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept;
512 class _LIBCPP_TEMPLATE_VIS complex<double> {
519 …_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re…
522 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex double __v)
525 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
526 _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
543 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(double __re) {
548 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {
552 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {
556 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {
561 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {
568 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
574 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
580 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
586 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
587 *this = *this * complex(__c.real(), __c.imag());
591 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
592 *this = *this / complex(__c.real(), __c.imag());
598 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept;
601 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept;
604 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept;
607 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept;
612 class _LIBCPP_TEMPLATE_VIS complex<long double> {
619 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
623 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex long double __v)
626 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
627 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
644 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(long double __re) {
649 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {
653 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {
657 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {
662 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {
669 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
675 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
681 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
687 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
688 *this = *this * complex(__c.real(), __c.imag());
692 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
693 *this = *this / complex(__c.real(), __c.imag());
699 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>&) noexcept;
702 friend _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&&) noexcept;
705 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>&) noexcept;
708 friend _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&&) noexcept;
712 inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), _…
714 inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<long double>& __c)
717 inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<float>& __c) : __re_(__c.real()), _…
719 inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<long double>& __c)
722 inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<float>& __c)
725 inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<double>& __c)
731 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
732 operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) {
733 complex<_Tp> __t(__x);
739 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
740 operator+(const complex<_Tp>& __x, const _Tp& __y) {
741 complex<_Tp> __t(__x);
747 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
748 operator+(const _Tp& __x, const complex<_Tp>& __y) {
749 complex<_Tp> __t(__y);
755 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
756 operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
757 complex<_Tp> __t(__x);
763 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
764 operator-(const complex<_Tp>& __x, const _Tp& __y) {
765 complex<_Tp> __t(__x);
771 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
772 operator-(const _Tp& __x, const complex<_Tp>& __y) {
773 complex<_Tp> __t(-__y);
779 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
780 operator*(const complex<_Tp>& __lhs, const complex<_Tp>& __rhs) {
781 return complex<_Tp>(__from_builtin_tag(), __lhs.__builtin() * __rhs.__builtin());
785 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
786 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) {
792 return complex<_Tp>((__a * __c) - (__b * __d), (__a * __d) + (__b * __c));
796 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
797 operator*(const complex<_Tp>& __x, const _Tp& __y) {
798 complex<_Tp> __t(__x);
804 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
805 operator*(const _Tp& __x, const complex<_Tp>& __y) {
806 complex<_Tp> __t(__y);
812 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
813 operator/(const complex<_Tp>& __lhs, const complex<_Tp>& __rhs) {
814 return complex<_Tp>(__from_builtin_tag(), __lhs.__builtin() / __rhs.__builtin());
818 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
819 operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) {
826 return complex<_Tp>((__a * __c + __b * __d) / __denom, (__b * __c - __a * __d) / __denom);
830 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
831 operator/(const complex<_Tp>& __x, const _Tp& __y) {
832 return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
836 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
837 operator/(const _Tp& __x, const complex<_Tp>& __y) {
838 complex<_Tp> __t(__x);
844 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator+(const complex<_Tp…
849 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator-(const complex<_Tp…
850 return complex<_Tp>(-__x.real(), -__x.imag());
855 operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) {
860 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const complex<_Tp>& __x,…
867 …E_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const _Tp& __x, const complex<_Tp>& __y) {
873 operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) {
878 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const complex<_Tp>& __x,…
883 …E_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const _Tp& __x, const complex<_Tp>& __y) {
898 typedef complex<double> _ComplexType;
905 typedef complex<_Tp> _ComplexType;
911 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
924 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp imag(const complex<_Tp>& __c) {
937 inline _LIBCPP_HIDE_FROM_ABI _Tp abs(const complex<_Tp>& __c) {
944 inline _LIBCPP_HIDE_FROM_ABI _Tp arg(const complex<_Tp>& __c) {
966 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const complex<_Tp>& __c) {
984 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> conj(const complex<_Tp>& __…
985 return complex<_Tp>(__c.real(), -__c.imag());
998 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
999 complex<_Tp> __r = __c;
1001 __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
1009 return complex<_Tp>(__re);
1021 _LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) {
1023 return complex<_Tp>(_Tp(NAN), _Tp(NAN));
1026 return complex<_Tp>(__rho, __theta);
1027 return complex<_Tp>(__theta, __theta);
1031 return complex<_Tp>(__rho, _Tp(NAN));
1032 return complex<_Tp>(_Tp(NAN), _Tp(NAN));
1040 return complex<_Tp>(__x, __y);
1046 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log(const complex<_Tp>& __x) {
1047 return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
1053 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
1060 _LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
1062 return complex<_Tp>(_Tp(INFINITY), __x.imag());
1065 return complex<_Tp>(
1067 return complex<_Tp>(
1076 _LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
1079 return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
1088 return complex<_Tp>(__x.real(), __i);
1092 return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
1098 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) {
1103 inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type>
1104 pow(const complex<_Tp>& __x, const complex<_Up>& __y) {
1105 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1110 inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const complex<_Tp>& __…
1111 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1116 inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const _Tp& __x, const
1117 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1124 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> __sqr(const complex<_Tp>& __x) {
1125 …return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), _Tp(2) * __x.real() * _…
1131 _LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
1137 return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
1138 return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
1142 return complex<_Tp>(__x.imag(), __x.real());
1145 return complex<_Tp>(__x.real(), __x.real());
1148 …return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()…
1149 complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
1150 return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
1156 _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
1160 return complex<_Tp>(std::abs(__x.real()), __x.imag());
1163 return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
1165 return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
1168 return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
1169 return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
1173 return complex<_Tp>(std::abs(__x.imag()), __x.real());
1174 return complex<_Tp>(__x.real(), __x.real());
1177 return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi / _Tp(2), __x.imag()));
1178 complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
1179 return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
1185 _LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
1188 … return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
1192 return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
1193 return complex<_Tp>(__x.imag(), __x.imag());
1196 return complex<_Tp>(__x.real(), __x.real());
1199 … return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
1202 … return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
1204 complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
1205 return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
1211 _LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
1213 return complex<_Tp>(__x.real(), _Tp(NAN));
1215 return complex<_Tp>(__x.real(), _Tp(NAN));
1218 …return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin…
1224 _LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
1226 return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
1228 return complex<_Tp>(_Tp(NAN), __x.real());
1230 return complex<_Tp>(_Tp(1), __x.imag());
1232 return complex<_Tp>(std::abs(__x.real()), __x.imag());
1233 …return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin…
1239 _LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
1242 return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
1243 …return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x…
1252 return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
1253 return complex<_Tp>(__2rsh / __d, std::sin(__2i) / __d);
1259 _LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
1260 complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
1261 return complex<_Tp>(__z.imag(), -__z.real());
1267 _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
1271 return complex<_Tp>(__x.imag(), __x.real());
1274 return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
1275 return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
1278 return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
1279 return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
1283 return complex<_Tp>(__x.real(), -__x.imag());
1284 return complex<_Tp>(__x.real(), __x.real());
1287 return complex<_Tp>(__pi / _Tp(2), -__x.imag());
1289 return complex<_Tp>(__pi / _Tp(2), -__x.imag());
1290 complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
1292 return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
1293 return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
1299 _LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
1300 complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
1301 return complex<_Tp>(__z.imag(), -__z.real());
1307 _LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
1308 complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
1309 return complex<_Tp>(__z.imag(), -__z.real());
1315 inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> cos(const complex<_Tp>& __x) {
1316 return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
1322 _LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
1323 complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
1324 return complex<_Tp>(__z.imag(), -__z.real());
1330 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) {
1349 __x = complex<_Tp>(__r, __i);
1356 __x = complex<_Tp>(__r, _Tp(0));
1365 __x = complex<_Tp>(__r, _Tp(0));
1376 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) {
1388 // [complex.tuple], tuple interface
1391 struct tuple_size<complex<_Tp>> : integral_constant<size_t, 2> {};
1394 struct tuple_element<_Ip, complex<_Tp>> {
1400 _LIBCPP_HIDE_FROM_ABI constexpr _Xp& get(complex<_Xp>& __z) noexcept {
1410 _LIBCPP_HIDE_FROM_ABI constexpr _Xp&& get(complex<_Xp>&& __z) noexcept {
1420 _LIBCPP_HIDE_FROM_ABI constexpr const _Xp& get(const complex<_Xp>& __z) noexcept {
1430 _LIBCPP_HIDE_FROM_ABI constexpr const _Xp&& get(const complex<_Xp>&& __z) noexcept {
1442 // Literal suffix for complex number literals [complex.literals]
1445 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(long double __im) { return…
1447 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(unsigned long long __im) {
1451 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(long double __im) {
1455 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long long __im) {
1459 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) {
1463 _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) {