• Home
  • Raw
  • Download

Lines Matching refs:_Tp

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);
263 template<class _Tp>
267 typedef _Tp value_type;
525 template<class _Tp>
527 complex<_Tp>
528 operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
530 complex<_Tp> __t(__x);
535 template<class _Tp>
537 complex<_Tp>
538 operator+(const complex<_Tp>& __x, const _Tp& __y)
540 complex<_Tp> __t(__x);
545 template<class _Tp>
547 complex<_Tp>
548 operator+(const _Tp& __x, const complex<_Tp>& __y)
550 complex<_Tp> __t(__y);
555 template<class _Tp>
557 complex<_Tp>
558 operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
560 complex<_Tp> __t(__x);
565 template<class _Tp>
567 complex<_Tp>
568 operator-(const complex<_Tp>& __x, const _Tp& __y)
570 complex<_Tp> __t(__x);
575 template<class _Tp>
577 complex<_Tp>
578 operator-(const _Tp& __x, const complex<_Tp>& __y)
580 complex<_Tp> __t(-__y);
585 template<class _Tp>
586 complex<_Tp>
587 operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
589 _Tp __a = __z.real();
590 _Tp __b = __z.imag();
591 _Tp __c = __w.real();
592 _Tp __d = __w.imag();
593 _Tp __ac = __a * __c;
594 _Tp __bd = __b * __d;
595 _Tp __ad = __a * __d;
596 _Tp __bc = __b * __c;
597 _Tp __x = __ac - __bd;
598 _Tp __y = __ad + __bc;
604 __a = copysign(isinf(__a) ? _Tp(1) : _Tp(0), __a);
605 __b = copysign(isinf(__b) ? _Tp(1) : _Tp(0), __b);
607 __c = copysign(_Tp(0), __c);
609 __d = copysign(_Tp(0), __d);
614 __c = copysign(isinf(__c) ? _Tp(1) : _Tp(0), __c);
615 __d = copysign(isinf(__d) ? _Tp(1) : _Tp(0), __d);
617 __a = copysign(_Tp(0), __a);
619 __b = copysign(_Tp(0), __b);
626 __a = copysign(_Tp(0), __a);
628 __b = copysign(_Tp(0), __b);
630 __c = copysign(_Tp(0), __c);
632 __d = copysign(_Tp(0), __d);
637 __x = _Tp(INFINITY) * (__a * __c - __b * __d);
638 __y = _Tp(INFINITY) * (__a * __d + __b * __c);
641 return complex<_Tp>(__x, __y);
644 template<class _Tp>
646 complex<_Tp>
647 operator*(const complex<_Tp>& __x, const _Tp& __y)
649 complex<_Tp> __t(__x);
654 template<class _Tp>
656 complex<_Tp>
657 operator*(const _Tp& __x, const complex<_Tp>& __y)
659 complex<_Tp> __t(__y);
664 template<class _Tp>
665 complex<_Tp>
666 operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
669 _Tp __a = __z.real();
670 _Tp __b = __z.imag();
671 _Tp __c = __w.real();
672 _Tp __d = __w.imag();
673 _Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
680 _Tp __denom = __c * __c + __d * __d;
681 _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
682 _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
685 if ((__denom == _Tp(0)) && (!isnan(__a) || !isnan(__b)))
687 __x = copysign(_Tp(INFINITY), __c) * __a;
688 __y = copysign(_Tp(INFINITY), __c) * __b;
692 __a = copysign(isinf(__a) ? _Tp(1) : _Tp(0), __a);
693 __b = copysign(isinf(__b) ? _Tp(1) : _Tp(0), __b);
694 __x = _Tp(INFINITY) * (__a * __c + __b * __d);
695 __y = _Tp(INFINITY) * (__b * __c - __a * __d);
697 else if (isinf(__logbw) && __logbw > _Tp(0) && isfinite(__a) && isfinite(__b))
699 __c = copysign(isinf(__c) ? _Tp(1) : _Tp(0), __c);
700 __d = copysign(isinf(__d) ? _Tp(1) : _Tp(0), __d);
701 __x = _Tp(0) * (__a * __c + __b * __d);
702 __y = _Tp(0) * (__b * __c - __a * __d);
705 return complex<_Tp>(__x, __y);
708 template<class _Tp>
710 complex<_Tp>
711 operator/(const complex<_Tp>& __x, const _Tp& __y)
713 return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
716 template<class _Tp>
718 complex<_Tp>
719 operator/(const _Tp& __x, const complex<_Tp>& __y)
721 complex<_Tp> __t(__x);
726 template<class _Tp>
728 complex<_Tp>
729 operator+(const complex<_Tp>& __x)
734 template<class _Tp>
736 complex<_Tp>
737 operator-(const complex<_Tp>& __x)
739 return complex<_Tp>(-__x.real(), -__x.imag());
742 template<class _Tp>
745 operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
750 template<class _Tp>
753 operator==(const complex<_Tp>& __x, const _Tp& __y)
758 template<class _Tp>
761 operator==(const _Tp& __x, const complex<_Tp>& __y)
766 template<class _Tp>
769 operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
774 template<class _Tp>
777 operator!=(const complex<_Tp>& __x, const _Tp& __y)
782 template<class _Tp>
785 operator!=(const _Tp& __x, const complex<_Tp>& __y)
794 template<class _Tp>
796 _Tp
797 real(const complex<_Tp>& __c)
816 template<class _Tp>
820 is_integral<_Tp>::value,
823 real(_Tp __re)
837 template<class _Tp>
839 _Tp
840 imag(const complex<_Tp>& __c)
859 template<class _Tp>
863 is_integral<_Tp>::value,
866 imag(_Tp __re)
880 template<class _Tp>
882 _Tp
883 abs(const complex<_Tp>& __c)
890 template<class _Tp>
892 _Tp
893 arg(const complex<_Tp>& __c)
912 template<class _Tp>
916 is_integral<_Tp>::value,
919 arg(_Tp __re)
933 template<class _Tp>
935 _Tp
936 norm(const complex<_Tp>& __c)
959 template<class _Tp>
963 is_integral<_Tp>::value,
966 norm(_Tp __re)
980 template<class _Tp>
982 complex<_Tp>
983 conj(const complex<_Tp>& __c)
985 return complex<_Tp>(__c.real(), -__c.imag());
1002 template<class _Tp>
1006 is_integral<_Tp>::value,
1009 conj(_Tp __re)
1023 template<class _Tp>
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()));
1052 template<class _Tp>
1056 is_integral<_Tp>::value,
1059 proj(_Tp __re)
1075 template<class _Tp>
1076 complex<_Tp>
1077 polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
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));
1093 _Tp __x = __rho * cos(__theta);
1096 _Tp __y = __rho * sin(__theta);
1099 return complex<_Tp>(__x, __y);
1104 template<class _Tp>
1106 complex<_Tp>
1107 log(const complex<_Tp>& __x)
1109 return complex<_Tp>(log(abs(__x)), arg(__x));
1114 template<class _Tp>
1116 complex<_Tp>
1117 log10(const complex<_Tp>& __x)
1119 return log(__x) / log(_Tp(10));
1124 template<class _Tp>
1125 complex<_Tp>
1126 sqrt(const complex<_Tp>& __x)
1129 return complex<_Tp>(_Tp(INFINITY), __x.imag());
1132 if (__x.real() > _Tp(0))
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()));
1136 return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
1141 template<class _Tp>
1142 complex<_Tp>
1143 exp(const complex<_Tp>& __x)
1145 _Tp __i = __x.imag();
1148 if (__x.real() < _Tp(0))
1151 __i = _Tp(1);
1156 __i = _Tp(NAN);
1157 return complex<_Tp>(__x.real(), __i);
1162 _Tp __e = exp(__x.real());
1163 return complex<_Tp>(__e * cos(__i), __e * sin(__i));
1168 template<class _Tp>
1170 complex<_Tp>
1171 pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
1176 template<class _Tp, class _Up>
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;
1185 template<class _Tp, class _Up>
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;
1198 template<class _Tp, class _Up>
1202 is_arithmetic<_Tp>::value,
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;
1213 template<class _Tp>
1214 complex<_Tp>
1215 asinh(const complex<_Tp>& __x)
1217 const _Tp __pi(atan2(+0., -0.));
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()));
1242 template<class _Tp>
1243 complex<_Tp>
1244 acosh(const complex<_Tp>& __x)
1246 const _Tp __pi(atan2(+0., -0.));
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()));
1276 template<class _Tp>
1277 complex<_Tp>
1278 atanh(const complex<_Tp>& __x)
1280 const _Tp __pi(atan2(+0., -0.));
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()));
1299 if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
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()));
1309 template<class _Tp>
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()));
1324 template<class _Tp>
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()));
1341 template<class _Tp>
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())));
1353 _Tp __2r(_Tp(2) * __x.real());
1354 _Tp __2i(_Tp(2) * __x.imag());
1355 _Tp __d(cosh(__2r) + cos(__2i));
1356 _Tp __2rsh(sinh(__2r));
1358 return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
1359 __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
1360 return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
1365 template<class _Tp>
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());
1375 template<class _Tp>
1376 complex<_Tp>
1377 acos(const complex<_Tp>& __x)
1379 const _Tp __pi(atan2(+0., -0.));
1383 return complex<_Tp>(__x.imag(), __x.real());
1386 if (__x.real() < _Tp(0))
1387 return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
1388 return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
1390 if (__x.real() < _Tp(0))
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()));
1412 template<class _Tp>
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());
1422 template<class _Tp>
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());
1432 template<class _Tp>
1434 complex<_Tp>
1435 cos(const complex<_Tp>& __x)
1437 return cosh(complex<_Tp>(-__x.imag(), __x.real()));
1442 template<class _Tp>
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());
1450 template<class _Tp, class _CharT, class _Traits>
1452 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
1460 _Tp __r;
1469 _Tp __i;
1478 __x = complex<_Tp>(__r, __i);
1489 __x = complex<_Tp>(__r, _Tp(0));
1499 _Tp __r;
1502 __x = complex<_Tp>(__r, _Tp(0));
1512 template<class _Tp, class _CharT, class _Traits>
1514 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)