Lines Matching full:complex
2 //===--------------------------- complex ----------------------------------===//
15 complex synopsis
21 class complex
26 complex(const T& re = T(), const T& im = T()); // constexpr in C++14
27 complex(const complex&); // constexpr in C++14
28 template<class X> complex(const complex<X>&); // constexpr in C++14
36 complex<T>& operator= (const T&);
37 complex<T>& operator+=(const T&);
38 complex<T>& operator-=(const T&);
39 complex<T>& operator*=(const T&);
40 complex<T>& operator/=(const T&);
42 complex& operator=(const complex&);
43 template<class X> complex<T>& operator= (const complex<X>&);
44 template<class X> complex<T>& operator+=(const complex<X>&);
45 template<class X> complex<T>& operator-=(const complex<X>&);
46 template<class X> complex<T>& operator*=(const complex<X>&);
47 template<class X> complex<T>& operator/=(const complex<X>&);
51 class complex<float>
56 constexpr complex(float re = 0.0f, float im = 0.0f);
57 explicit constexpr complex(const complex<double>&);
58 explicit constexpr complex(const complex<long double>&);
65 complex<float>& operator= (float);
66 complex<float>& operator+=(float);
67 complex<float>& operator-=(float);
68 complex<float>& operator*=(float);
69 complex<float>& operator/=(float);
71 complex<float>& operator=(const complex<float>&);
72 template<class X> complex<float>& operator= (const complex<X>&);
73 template<class X> complex<float>& operator+=(const complex<X>&);
74 template<class X> complex<float>& operator-=(const complex<X>&);
75 template<class X> complex<float>& operator*=(const complex<X>&);
76 template<class X> complex<float>& operator/=(const complex<X>&);
80 class complex<double>
85 constexpr complex(double re = 0.0, double im = 0.0);
86 constexpr complex(const complex<float>&);
87 explicit constexpr complex(const complex<long double>&);
94 complex<double>& operator= (double);
95 complex<double>& operator+=(double);
96 complex<double>& operator-=(double);
97 complex<double>& operator*=(double);
98 complex<double>& operator/=(double);
99 complex<double>& operator=(const complex<double>&);
101 template<class X> complex<double>& operator= (const complex<X>&);
102 template<class X> complex<double>& operator+=(const complex<X>&);
103 template<class X> complex<double>& operator-=(const complex<X>&);
104 template<class X> complex<double>& operator*=(const complex<X>&);
105 template<class X> complex<double>& operator/=(const complex<X>&);
109 class complex<long double>
114 constexpr complex(long double re = 0.0L, long double im = 0.0L);
115 constexpr complex(const complex<float>&);
116 constexpr complex(const complex<double>&);
123 complex<long double>& operator=(const complex<long double>&);
124 complex<long double>& operator= (long double);
125 complex<long double>& operator+=(long double);
126 complex<long double>& operator-=(long double);
127 complex<long double>& operator*=(long double);
128 complex<long double>& operator/=(long double);
130 template<class X> complex<long double>& operator= (const complex<X>&);
131 template<class X> complex<long double>& operator+=(const complex<X>&);
132 template<class X> complex<long double>& operator-=(const complex<X>&);
133 template<class X> complex<long double>& operator*=(const complex<X>&);
134 template<class X> complex<long double>& operator/=(const complex<X>&);
138 template<class T> complex<T> operator+(const complex<T>&, const complex<T>&);
139 template<class T> complex<T> operator+(const complex<T>&, const T&);
140 template<class T> complex<T> operator+(const T&, const complex<T>&);
141 template<class T> complex<T> operator-(const complex<T>&, const complex<T>&);
142 template<class T> complex<T> operator-(const complex<T>&, const T&);
143 template<class T> complex<T> operator-(const T&, const complex<T>&);
144 template<class T> complex<T> operator*(const complex<T>&, const complex<T>&);
145 template<class T> complex<T> operator*(const complex<T>&, const T&);
146 template<class T> complex<T> operator*(const T&, const complex<T>&);
147 template<class T> complex<T> operator/(const complex<T>&, const complex<T>&);
148 template<class T> complex<T> operator/(const complex<T>&, const T&);
149 template<class T> complex<T> operator/(const T&, const complex<T>&);
150 template<class T> complex<T> operator+(const complex<T>&);
151 template<class T> complex<T> operator-(const complex<T>&);
152 template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
153 template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
154 template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
155 template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
156 template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
157 template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
161 operator>>(basic_istream<charT, traits>&, complex<T>&);
164 operator<<(basic_ostream<charT, traits>&, const complex<T>&);
168 template<class T> T real(const complex<T>&); // constexpr in C++14
174 template<class T> T imag(const complex<T>&); // constexpr in C++14
180 template<class T> T abs(const complex<T>&);
182 template<class T> T arg(const complex<T>&);
188 template<class T> T norm(const complex<T>&);
194 template<class T> complex<T> conj(const complex<T>&);
195 complex<long double> conj(long double);
196 complex<double> conj(double);
197 template<Integral T> complex<double> conj(T);
198 complex<float> conj(float);
200 template<class T> complex<T> proj(const complex<T>&);
201 complex<long double> proj(long double);
202 complex<double> proj(double);
203 template<Integral T> complex<double> proj(T);
204 complex<float> proj(float);
206 template<class T> complex<T> polar(const T&, const T& = 0);
209 template<class T> complex<T> acos(const complex<T>&);
210 template<class T> complex<T> asin(const complex<T>&);
211 template<class T> complex<T> atan(const complex<T>&);
212 template<class T> complex<T> acosh(const complex<T>&);
213 template<class T> complex<T> asinh(const complex<T>&);
214 template<class T> complex<T> atanh(const complex<T>&);
215 template<class T> complex<T> cos (const complex<T>&);
216 template<class T> complex<T> cosh (const complex<T>&);
217 template<class T> complex<T> exp (const complex<T>&);
218 template<class T> complex<T> log (const complex<T>&);
219 template<class T> complex<T> log10(const complex<T>&);
221 template<class T> complex<T> pow(const complex<T>&, const T&);
222 template<class T> complex<T> pow(const complex<T>&, const complex<T>&);
223 template<class T> complex<T> pow(const T&, const complex<T>&);
225 template<class T> complex<T> sin (const complex<T>&);
226 template<class T> complex<T> sinh (const complex<T>&);
227 template<class T> complex<T> sqrt (const complex<T>&);
228 template<class T> complex<T> tan (const complex<T>&);
229 template<class T> complex<T> tanh (const complex<T>&);
233 operator>>(basic_istream<charT, traits>& is, complex<T>& x);
237 operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
258 template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
260 template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
261 template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
264 class _LIBCPP_TYPE_VIS_ONLY complex
273 complex(const value_type& __re = value_type(), const value_type& __im = value_type())
276 complex(const complex<_Xp>& __c)
285 _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
287 _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
288 _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
289 _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
290 _LIBCPP_INLINE_VISIBILITY complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;}
292 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
298 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
304 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
310 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
312 *this = *this * complex(__c.real(), __c.imag());
315 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
317 *this = *this / complex(__c.real(), __c.imag());
322 template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
323 template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
326 class _LIBCPP_TYPE_VIS_ONLY complex<float>
333 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
335 explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
336 explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
344 _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
346 _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
347 _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
348 _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
349 _LIBCPP_INLINE_VISIBILITY complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;}
351 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
357 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
363 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
369 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
371 *this = *this * complex(__c.real(), __c.imag());
374 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
376 *this = *this / complex(__c.real(), __c.imag());
382 class _LIBCPP_TYPE_VIS_ONLY complex<double>
389 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
391 _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
392 explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
400 _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
402 _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
403 _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
404 _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
405 _LIBCPP_INLINE_VISIBILITY complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;}
407 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
413 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
419 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
425 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
427 *this = *this * complex(__c.real(), __c.imag());
430 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
432 *this = *this / complex(__c.real(), __c.imag());
438 class _LIBCPP_TYPE_VIS_ONLY complex<long double>
445 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
447 _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
448 _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
456 _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
458 _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
459 _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
460 _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
461 _LIBCPP_INLINE_VISIBILITY complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;}
463 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c)
469 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c)
475 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c)
481 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
483 *this = *this * complex(__c.real(), __c.imag());
486 template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
488 *this = *this / complex(__c.real(), __c.imag());
495 complex<float>::complex(const complex<double>& __c)
500 complex<float>::complex(const complex<long double>& __c)
505 complex<double>::complex(const complex<float>& __c)
510 complex<double>::complex(const complex<long double>& __c)
515 complex<long double>::complex(const complex<float>& __c)
520 complex<long double>::complex(const complex<double>& __c)
527 complex<_Tp>
528 operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
530 complex<_Tp> __t(__x);
537 complex<_Tp>
538 operator+(const complex<_Tp>& __x, const _Tp& __y)
540 complex<_Tp> __t(__x);
547 complex<_Tp>
548 operator+(const _Tp& __x, const complex<_Tp>& __y)
550 complex<_Tp> __t(__y);
557 complex<_Tp>
558 operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
560 complex<_Tp> __t(__x);
567 complex<_Tp>
568 operator-(const complex<_Tp>& __x, const _Tp& __y)
570 complex<_Tp> __t(__x);
577 complex<_Tp>
578 operator-(const _Tp& __x, const complex<_Tp>& __y)
580 complex<_Tp> __t(-__y);
586 complex<_Tp>
587 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
641 return complex<_Tp>(__x, __y);
646 complex<_Tp>
647 operator*(const complex<_Tp>& __x, const _Tp& __y)
649 complex<_Tp> __t(__x);
656 complex<_Tp>
657 operator*(const _Tp& __x, const complex<_Tp>& __y)
659 complex<_Tp> __t(__y);
665 complex<_Tp>
666 operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
705 return complex<_Tp>(__x, __y);
710 complex<_Tp>
711 operator/(const complex<_Tp>& __x, const _Tp& __y)
713 return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
718 complex<_Tp>
719 operator/(const _Tp& __x, const complex<_Tp>& __y)
721 complex<_Tp> __t(__x);
728 complex<_Tp>
729 operator+(const complex<_Tp>& __x)
736 complex<_Tp>
737 operator-(const complex<_Tp>& __x)
739 return complex<_Tp>(-__x.real(), -__x.imag());
745 operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
753 operator==(const complex<_Tp>& __x, const _Tp& __y)
761 operator==(const _Tp& __x, const complex<_Tp>& __y)
769 operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
777 operator!=(const complex<_Tp>& __x, const _Tp& __y)
785 operator!=(const _Tp& __x, const complex<_Tp>& __y)
797 real(const complex<_Tp>& __c)
840 imag(const complex<_Tp>& __c)
883 abs(const complex<_Tp>& __c)
893 arg(const complex<_Tp>& __c)
936 norm(const complex<_Tp>& __c)
982 complex<_Tp>
983 conj(const complex<_Tp>& __c)
985 return complex<_Tp>(__c.real(), -__c.imag());
989 complex<long double>
992 return complex<long double>(__re);
996 complex<double>
999 return complex<double>(__re);
1007 complex<double>
1011 return complex<double>(__re);
1015 complex<float>
1018 return complex<float>(__re);
1025 complex<_Tp>
1026 proj(const complex<_Tp>& __c)
1028 std::complex<_Tp> __r = __c;
1030 __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
1035 complex<long double>
1040 return complex<long double>(__re);
1044 complex<double>
1049 return complex<double>(__re);
1057 complex<double>
1061 return complex<double>(__re);
1065 complex<float>
1070 return complex<float>(__re);
1076 complex<_Tp>
1080 return complex<_Tp>(_Tp(NAN), _Tp(NAN));
1084 return complex<_Tp>(__rho, __theta);
1085 return complex<_Tp>(__theta, __theta);
1090 return complex<_Tp>(__rho, _Tp(NAN));
1091 return complex<_Tp>(_Tp(NAN), _Tp(NAN));
1099 return complex<_Tp>(__x, __y);
1106 complex<_Tp>
1107 log(const complex<_Tp>& __x)
1109 return complex<_Tp>(log(abs(__x)), arg(__x));
1116 complex<_Tp>
1117 log10(const complex<_Tp>& __x)
1125 complex<_Tp>
1126 sqrt(const complex<_Tp>& __x)
1129 return complex
1133 return complex<_Tp>(__x.real(), isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
1134 return complex<_Tp>(isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
1142 complex<_Tp>
1143 exp(const complex<_Tp>& __x)
1157 return complex<_Tp>(__x.real(), __i);
1163 return complex<_Tp>(__e * cos(__i), __e * sin(__i));
1170 complex<_Tp>
1171 pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
1178 complex<typename __promote<_Tp, _Up>::type>
1179 pow(const complex<_Tp>& __x, const complex<_Up>& __y)
1181 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1190 complex<typename __promote<_Tp, _Up>::type>
1192 pow(const complex<_Tp>& __x, const _Up& __y)
1194 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1203 complex<typename __promote<_Tp, _Up>::type>
1205 pow(const _Tp& __x, const complex<_Up>& __y)
1207 typedef complex<typename __promote<_Tp, _Up>::type> result_type;
1214 complex<_Tp>
1215 asinh(const complex<_Tp>& __x)
1223 return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
1224 return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
1229 return complex<_Tp>(__x.imag(), __x.real());
1232 return complex<_Tp>(__x.real(), __x.real());
1235 return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
1236 complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
1237 return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
1243 complex<_Tp>
1244 acosh(const complex<_Tp>& __x)
1250 return complex<_Tp>(abs(__x.real()), __x.imag());
1254 return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
1256 return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
1259 return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
1260 return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
1265 return complex<_Tp>(abs(__x.imag()), __x.real());
1266 return complex<_Tp>(__x.real(), __x.real());
1269 return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
1270 complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
1271 return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
1277 complex<_Tp>
1278 atanh(const complex<_Tp>& __x)
1283 return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
1288 return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
1289 return complex<_Tp>(__x.imag(), __x.imag());
1293 return complex<_Tp>(__x.real(), __x.real());
1297 return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
1301 return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag()));
1303 complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
1304 return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
1310 complex<_Tp>
1311 sinh(const complex<_Tp>& __x)
1314 return complex<_Tp>(__x.real(), _Tp(NAN));
1316 return complex<_Tp>(__x.real(), _Tp(NAN));
1319 return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
1325 complex<_Tp>
1326 cosh(const complex<_Tp>& __x)
1329 return complex<_Tp>(abs(__x.real()), _Tp(NAN));
1331 return complex<_Tp>(_Tp(NAN), __x.real());
1333 return complex<_Tp>(_Tp(1), __x.imag());
1335 return complex<_Tp>(abs(__x.real()), __x.imag());
1336 return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
1342 complex<_Tp>
1343 tanh(const complex<_Tp>& __x)
1348 return complex<_Tp>(_Tp(1), _Tp(0));
1349 return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
1358 return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
1360 return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
1366 complex<_Tp>
1367 asin(const complex<_Tp>& __x)
1369 complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
1370 return complex<_Tp>(__z.imag(), -__z.real());
1376 complex<_Tp>
1377 acos(const complex<_Tp>& __x)
1383 return complex<_Tp>(__x.imag(), __x.real());
1387 return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
1388 return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
1391 return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
1392 return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
1397 return complex<_Tp>(__x.real(), -__x.imag());
1398 return complex<_Tp>(__x.real(), __x.real());
1401 return complex<_Tp>(__pi/_Tp(2), -__x.imag());
1403 return complex<_Tp>(__pi/_Tp(2), -__x.imag());
1404 complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
1406 return complex<_Tp>(abs(__z.imag()), abs(__z.real()));
1407 return complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
1413 complex<_Tp>
1414 atan(const complex<_Tp>& __x)
1416 complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
1417 return complex<_Tp>(__z.imag(), -__z.real());
1423 complex<_Tp>
1424 sin(const complex<_Tp>& __x)
1426 complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
1427 return complex<_Tp>(__z.imag(), -__z.real());
1434 complex<_Tp>
1435 cos(const complex<_Tp>& __x)
1437 return cosh(complex<_Tp>(-__x.imag(), __x.real()));
1443 complex<_Tp>
1444 tan(const complex<_Tp>& __x)
1446 complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
1447 return complex<_Tp>(__z.imag(), -__z.real());
1452 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
1478 __x = complex<_Tp>(__r, __i);
1489 __x = complex<_Tp>(__r, _Tp(0));
1502 __x = complex<_Tp>(__r, _Tp(0));
1514 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
1525 // Literal suffix for complex number literals [complex.literals]
1530 constexpr complex<long double> operator""il(long double __im)
1535 constexpr complex<long double> operator""il(unsigned long long __im)
1541 constexpr complex<double> operator""i(long double __im)
1546 constexpr complex<double> operator""i(unsigned long long __im)
1552 constexpr complex<float> operator""if(long double __im)
1557 constexpr complex<float> operator""if(unsigned long long __im)