36 #ifndef _GLIBCXX_COMPLEX 37 #define _GLIBCXX_COMPLEX 1 39 #pragma GCC system_header 50 namespace std _GLIBCXX_VISIBILITY(default)
52 _GLIBCXX_BEGIN_NAMESPACE_VERSION
64 template<>
class complex<float>;
65 template<>
class complex<double>;
66 template<>
class complex<long double>;
121 template<
typename _Tp>
129 _GLIBCXX_CONSTEXPR
complex(
const _Tp& __r = _Tp(),
const _Tp& __i = _Tp())
130 : _M_real(__r), _M_imag(__i) { }
133 #if __cplusplus >= 201103L 138 template<
typename _Up>
140 : _M_real(__z.real()), _M_imag(__z.imag()) { }
142 #if __cplusplus >= 201103L 145 _GLIBCXX_ABI_TAG_CXX11
147 real()
const {
return _M_real; }
149 _GLIBCXX_ABI_TAG_CXX11
151 imag()
const {
return _M_imag; }
155 real() {
return _M_real; }
159 real()
const {
return _M_real; }
163 imag() {
return _M_imag; }
167 imag()
const {
return _M_imag; }
173 real(_Tp __val) { _M_real = __val; }
176 imag(_Tp __val) { _M_imag = __val; }
205 #if __cplusplus >= 201103L 210 template<
typename _Up>
213 template<
typename _Up>
216 template<
typename _Up>
219 template<
typename _Up>
222 template<
typename _Up>
225 _GLIBCXX_CONSTEXPR
complex __rep()
const 233 template<
typename _Tp>
243 template<
typename _Tp>
253 template<
typename _Tp>
262 template<
typename _Tp>
263 template<
typename _Up>
267 _M_real = __z.real();
268 _M_imag = __z.imag();
273 template<
typename _Tp>
274 template<
typename _Up>
278 _M_real += __z.real();
279 _M_imag += __z.imag();
284 template<
typename _Tp>
285 template<
typename _Up>
289 _M_real -= __z.real();
290 _M_imag -= __z.imag();
296 template<
typename _Tp>
297 template<
typename _Up>
301 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
302 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
309 template<
typename _Tp>
310 template<
typename _Up>
314 const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
316 _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
324 template<
typename _Tp>
333 template<
typename _Tp>
342 template<
typename _Tp>
354 template<
typename _Tp>
363 template<
typename _Tp>
372 template<
typename _Tp>
384 template<
typename _Tp>
393 template<
typename _Tp>
402 template<
typename _Tp>
414 template<
typename _Tp>
423 template<
typename _Tp>
432 template<
typename _Tp>
443 template<
typename _Tp>
449 template<
typename _Tp>
456 template<
typename _Tp>
457 inline _GLIBCXX_CONSTEXPR
bool 459 {
return __x.real() == __y.real() && __x.imag() == __y.imag(); }
461 template<
typename _Tp>
462 inline _GLIBCXX_CONSTEXPR
bool 464 {
return __x.real() == __y && __x.imag() == _Tp(); }
466 template<
typename _Tp>
467 inline _GLIBCXX_CONSTEXPR
bool 469 {
return __x == __y.real() && _Tp() == __y.imag(); }
474 template<
typename _Tp>
475 inline _GLIBCXX_CONSTEXPR
bool 477 {
return __x.real() != __y.real() || __x.imag() != __y.imag(); }
479 template<
typename _Tp>
480 inline _GLIBCXX_CONSTEXPR
bool 482 {
return __x.real() != __y || __x.imag() != _Tp(); }
484 template<
typename _Tp>
485 inline _GLIBCXX_CONSTEXPR
bool 487 {
return __x != __y.real() || _Tp() != __y.imag(); }
491 template<
typename _Tp,
typename _CharT,
class _Traits>
500 __is >> __re_x >> __ch;
503 __is >> __im_x >> __ch;
509 else if (__ch ==
')')
524 template<
typename _Tp,
typename _CharT,
class _Traits>
526 operator<<(basic_ostream<_CharT, _Traits>& __os,
const complex<_Tp>& __x)
529 __s.
flags(__os.flags());
530 __s.
imbue(__os.getloc());
532 __s <<
'(' << __x.real() <<
',' << __x.imag() <<
')';
533 return __os << __s.
str();
537 #if __cplusplus >= 201103L 538 template<
typename _Tp>
541 {
return __z.real(); }
543 template<
typename _Tp>
546 {
return __z.imag(); }
548 template<
typename _Tp>
551 {
return __z.real(); }
553 template<
typename _Tp>
556 {
return __z.real(); }
558 template<
typename _Tp>
561 {
return __z.imag(); }
563 template<
typename _Tp>
566 {
return __z.imag(); }
570 template<
typename _Tp>
574 _Tp __x = __z.real();
575 _Tp __y = __z.imag();
581 return __s *
sqrt(__x * __x + __y * __y);
584 #if _GLIBCXX_USE_C99_COMPLEX 586 __complex_abs(__complex__
float __z) {
return __builtin_cabsf(__z); }
589 __complex_abs(__complex__
double __z) {
return __builtin_cabs(__z); }
592 __complex_abs(
const __complex__
long double& __z)
593 {
return __builtin_cabsl(__z); }
595 template<
typename _Tp>
599 template<
typename _Tp>
606 template<
typename _Tp>
609 {
return atan2(__z.imag(), __z.real()); }
611 #if _GLIBCXX_USE_C99_COMPLEX 613 __complex_arg(__complex__
float __z) {
return __builtin_cargf(__z); }
616 __complex_arg(__complex__
double __z) {
return __builtin_carg(__z); }
619 __complex_arg(
const __complex__
long double& __z)
620 {
return __builtin_cargl(__z); }
622 template<
typename _Tp>
626 template<
typename _Tp>
639 template<
typename _Tp>
642 const _Tp __x = __z.real();
643 const _Tp __y = __z.imag();
644 return __x * __x + __y * __y;
649 struct _Norm_helper<true>
651 template<
typename _Tp>
655 return __res * __res;
659 template<
typename _Tp>
663 return _Norm_helper<__is_floating<_Tp>::__value
664 && !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
667 template<
typename _Tp>
669 polar(
const _Tp& __rho,
const _Tp& __theta)
671 __glibcxx_assert( __rho >= 0 );
675 template<
typename _Tp>
683 template<
typename _Tp>
687 const _Tp __x = __z.real();
688 const _Tp __y = __z.imag();
692 #if _GLIBCXX_USE_C99_COMPLEX 693 inline __complex__
float 694 __complex_cos(__complex__
float __z) {
return __builtin_ccosf(__z); }
696 inline __complex__
double 697 __complex_cos(__complex__
double __z) {
return __builtin_ccos(__z); }
699 inline __complex__
long double 700 __complex_cos(
const __complex__
long double& __z)
701 {
return __builtin_ccosl(__z); }
703 template<
typename _Tp>
707 template<
typename _Tp>
713 template<
typename _Tp>
717 const _Tp __x = __z.real();
718 const _Tp __y = __z.imag();
722 #if _GLIBCXX_USE_C99_COMPLEX 723 inline __complex__
float 724 __complex_cosh(__complex__
float __z) {
return __builtin_ccoshf(__z); }
726 inline __complex__
double 727 __complex_cosh(__complex__
double __z) {
return __builtin_ccosh(__z); }
729 inline __complex__
long double 730 __complex_cosh(
const __complex__
long double& __z)
731 {
return __builtin_ccoshl(__z); }
733 template<
typename _Tp>
737 template<
typename _Tp>
743 template<
typename _Tp>
746 {
return std::polar<_Tp>(
exp(__z.real()), __z.imag()); }
748 #if _GLIBCXX_USE_C99_COMPLEX 749 inline __complex__
float 750 __complex_exp(__complex__
float __z) {
return __builtin_cexpf(__z); }
752 inline __complex__
double 753 __complex_exp(__complex__
double __z) {
return __builtin_cexp(__z); }
755 inline __complex__
long double 756 __complex_exp(
const __complex__
long double& __z)
757 {
return __builtin_cexpl(__z); }
759 template<
typename _Tp>
763 template<
typename _Tp>
770 template<
typename _Tp>
775 #if _GLIBCXX_USE_C99_COMPLEX 776 inline __complex__
float 777 __complex_log(__complex__
float __z) {
return __builtin_clogf(__z); }
779 inline __complex__
double 780 __complex_log(__complex__
double __z) {
return __builtin_clog(__z); }
782 inline __complex__
long double 783 __complex_log(
const __complex__
long double& __z)
784 {
return __builtin_clogl(__z); }
786 template<
typename _Tp>
790 template<
typename _Tp>
795 template<
typename _Tp>
801 template<
typename _Tp>
805 const _Tp __x = __z.real();
806 const _Tp __y = __z.imag();
810 #if _GLIBCXX_USE_C99_COMPLEX 811 inline __complex__
float 812 __complex_sin(__complex__
float __z) {
return __builtin_csinf(__z); }
814 inline __complex__
double 815 __complex_sin(__complex__
double __z) {
return __builtin_csin(__z); }
817 inline __complex__
long double 818 __complex_sin(
const __complex__
long double& __z)
819 {
return __builtin_csinl(__z); }
821 template<
typename _Tp>
825 template<
typename _Tp>
831 template<
typename _Tp>
835 const _Tp __x = __z.real();
836 const _Tp __y = __z.imag();
840 #if _GLIBCXX_USE_C99_COMPLEX 841 inline __complex__
float 842 __complex_sinh(__complex__
float __z) {
return __builtin_csinhf(__z); }
844 inline __complex__
double 845 __complex_sinh(__complex__
double __z) {
return __builtin_csinh(__z); }
847 inline __complex__
long double 848 __complex_sinh(
const __complex__
long double& __z)
849 {
return __builtin_csinhl(__z); }
851 template<
typename _Tp>
855 template<
typename _Tp>
862 template<
typename _Tp>
866 _Tp __x = __z.real();
867 _Tp __y = __z.imag();
884 #if _GLIBCXX_USE_C99_COMPLEX 885 inline __complex__
float 886 __complex_sqrt(__complex__
float __z) {
return __builtin_csqrtf(__z); }
888 inline __complex__
double 889 __complex_sqrt(__complex__
double __z) {
return __builtin_csqrt(__z); }
891 inline __complex__
long double 892 __complex_sqrt(
const __complex__
long double& __z)
893 {
return __builtin_csqrtl(__z); }
895 template<
typename _Tp>
899 template<
typename _Tp>
906 template<
typename _Tp>
911 #if _GLIBCXX_USE_C99_COMPLEX 912 inline __complex__
float 913 __complex_tan(__complex__
float __z) {
return __builtin_ctanf(__z); }
915 inline __complex__
double 916 __complex_tan(__complex__
double __z) {
return __builtin_ctan(__z); }
918 inline __complex__
long double 919 __complex_tan(
const __complex__
long double& __z)
920 {
return __builtin_ctanl(__z); }
922 template<
typename _Tp>
926 template<
typename _Tp>
934 template<
typename _Tp>
939 #if _GLIBCXX_USE_C99_COMPLEX 940 inline __complex__
float 941 __complex_tanh(__complex__
float __z) {
return __builtin_ctanhf(__z); }
943 inline __complex__
double 944 __complex_tanh(__complex__
double __z) {
return __builtin_ctanh(__z); }
946 inline __complex__
long double 947 __complex_tanh(
const __complex__
long double& __z)
948 {
return __builtin_ctanhl(__z); }
950 template<
typename _Tp>
954 template<
typename _Tp>
963 template<
typename _Tp>
985 template<
typename _Tp>
990 ?
complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(
unsigned)__n)
991 : std::__complex_pow_unsigned(__z, __n);
994 template<
typename _Tp>
998 #if ! _GLIBCXX_USE_C99_COMPLEX 1002 if (__x.imag() == _Tp() && __x.real() > _Tp())
1003 return pow(__x.real(), __y);
1006 return std::polar<_Tp>(
exp(__y * __t.real()), __y * __t.imag());
1009 template<
typename _Tp>
1014 #if _GLIBCXX_USE_C99_COMPLEX 1015 inline __complex__
float 1016 __complex_pow(__complex__
float __x, __complex__
float __y)
1017 {
return __builtin_cpowf(__x, __y); }
1019 inline __complex__
double 1020 __complex_pow(__complex__
double __x, __complex__
double __y)
1021 {
return __builtin_cpow(__x, __y); }
1023 inline __complex__
long double 1024 __complex_pow(
const __complex__
long double& __x,
1025 const __complex__
long double& __y)
1026 {
return __builtin_cpowl(__x, __y); }
1028 template<
typename _Tp>
1031 {
return __complex_pow(__x.__rep(), __y.__rep()); }
1033 template<
typename _Tp>
1036 {
return __complex_pow(__x, __y); }
1039 template<
typename _Tp>
1043 return __x > _Tp() ? std::polar<_Tp>(
pow(__x, __y.real()),
1044 __y.imag() *
log(__x))
1054 typedef __complex__
float _ComplexT;
1056 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1058 _GLIBCXX_CONSTEXPR
complex(
float __r = 0.0f,
float __i = 0.0f)
1059 #if __cplusplus >= 201103L 1060 : _M_value{ __r, __i } { }
1063 __real__ _M_value = __r;
1064 __imag__ _M_value = __i;
1071 #if __cplusplus >= 201103L 1074 __attribute ((__abi_tag__ (
"cxx11")))
1076 real()
const {
return __real__ _M_value; }
1078 __attribute ((__abi_tag__ (
"cxx11")))
1080 imag()
const {
return __imag__ _M_value; }
1083 real() {
return __real__ _M_value; }
1086 real()
const {
return __real__ _M_value; }
1089 imag() {
return __imag__ _M_value; }
1092 imag()
const {
return __imag__ _M_value; }
1098 real(
float __val) { __real__ _M_value = __val; }
1101 imag(
float __val) { __imag__ _M_value = __val; }
1142 template<
typename _Tp>
1146 __real__ _M_value = __z.real();
1147 __imag__ _M_value = __z.imag();
1151 template<
typename _Tp>
1155 __real__ _M_value += __z.real();
1156 __imag__ _M_value += __z.imag();
1164 __real__ _M_value -= __z.real();
1165 __imag__ _M_value -= __z.imag();
1174 __real__ __t = __z.real();
1175 __imag__ __t = __z.imag();
1185 __real__ __t = __z.real();
1186 __imag__ __t = __z.imag();
1191 _GLIBCXX_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1203 typedef __complex__
double _ComplexT;
1205 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1207 _GLIBCXX_CONSTEXPR
complex(
double __r = 0.0,
double __i = 0.0)
1208 #if __cplusplus >= 201103L 1209 : _M_value{ __r, __i } { }
1212 __real__ _M_value = __r;
1213 __imag__ _M_value = __i;
1218 : _M_value(__z.__rep()) { }
1222 #if __cplusplus >= 201103L 1225 __attribute ((__abi_tag__ (
"cxx11")))
1227 real()
const {
return __real__ _M_value; }
1229 __attribute ((__abi_tag__ (
"cxx11")))
1231 imag()
const {
return __imag__ _M_value; }
1234 real() {
return __real__ _M_value; }
1237 real()
const {
return __real__ _M_value; }
1240 imag() {
return __imag__ _M_value; }
1243 imag()
const {
return __imag__ _M_value; }
1249 real(
double __val) { __real__ _M_value = __val; }
1252 imag(
double __val) { __imag__ _M_value = __val; }
1292 template<
typename _Tp>
1296 __real__ _M_value = __z.real();
1297 __imag__ _M_value = __z.imag();
1301 template<
typename _Tp>
1305 __real__ _M_value += __z.real();
1306 __imag__ _M_value += __z.imag();
1310 template<
typename _Tp>
1314 __real__ _M_value -= __z.real();
1315 __imag__ _M_value -= __z.imag();
1319 template<
typename _Tp>
1324 __real__ __t = __z.real();
1325 __imag__ __t = __z.imag();
1330 template<
typename _Tp>
1335 __real__ __t = __z.real();
1336 __imag__ __t = __z.imag();
1341 _GLIBCXX_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1353 typedef __complex__
long double _ComplexT;
1355 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1357 _GLIBCXX_CONSTEXPR
complex(
long double __r = 0.0L,
1358 long double __i = 0.0L)
1359 #if __cplusplus >= 201103L 1360 : _M_value{ __r, __i } { }
1363 __real__ _M_value = __r;
1364 __imag__ _M_value = __i;
1369 : _M_value(__z.__rep()) { }
1372 : _M_value(__z.__rep()) { }
1374 #if __cplusplus >= 201103L 1377 __attribute ((__abi_tag__ (
"cxx11")))
1378 constexpr
long double 1379 real()
const {
return __real__ _M_value; }
1381 __attribute ((__abi_tag__ (
"cxx11")))
1382 constexpr
long double 1383 imag()
const {
return __imag__ _M_value; }
1386 real() {
return __real__ _M_value; }
1389 real()
const {
return __real__ _M_value; }
1392 imag() {
return __imag__ _M_value; }
1395 imag()
const {
return __imag__ _M_value; }
1401 real(
long double __val) { __real__ _M_value = __val; }
1404 imag(
long double __val) { __imag__ _M_value = __val; }
1444 template<
typename _Tp>
1448 __real__ _M_value = __z.real();
1449 __imag__ _M_value = __z.imag();
1453 template<
typename _Tp>
1457 __real__ _M_value += __z.real();
1458 __imag__ _M_value += __z.imag();
1462 template<
typename _Tp>
1466 __real__ _M_value -= __z.real();
1467 __imag__ _M_value -= __z.imag();
1471 template<
typename _Tp>
1476 __real__ __t = __z.real();
1477 __imag__ __t = __z.imag();
1482 template<
typename _Tp>
1487 __real__ __t = __z.real();
1488 __imag__ __t = __z.imag();
1493 _GLIBCXX_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1501 inline _GLIBCXX_CONSTEXPR
1503 : _M_value(__z.__rep()) { }
1505 inline _GLIBCXX_CONSTEXPR
1507 : _M_value(__z.__rep()) { }
1509 inline _GLIBCXX_CONSTEXPR
1511 : _M_value(__z.__rep()) { }
1516 #if _GLIBCXX_EXTERN_TEMPLATE 1518 extern template ostream& operator<<(ostream&, const complex<float>&);
1520 extern template ostream& operator<<(ostream&, const complex<double>&);
1522 extern template ostream& operator<<(ostream&, const complex<long double>&);
1524 #ifdef _GLIBCXX_USE_WCHAR_T 1526 extern template wostream& operator<<(wostream&, const complex<float>&);
1528 extern template wostream& operator<<(wostream&, const complex<double>&);
1530 extern template wostream& operator<<(wostream&, const complex<long double>&);
1536 _GLIBCXX_END_NAMESPACE_VERSION
1539 namespace __gnu_cxx _GLIBCXX_VISIBILITY(
default)
1541 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1544 template<
typename _Tp,
typename _Up>
1545 struct __promote_2<std::complex<_Tp>, _Up>
1551 template<
typename _Tp,
typename _Up>
1552 struct __promote_2<_Tp, std::
complex<_Up> >
1558 template<
typename _Tp,
typename _Up>
1565 _GLIBCXX_END_NAMESPACE_VERSION
1568 #if __cplusplus >= 201103L 1570 namespace std _GLIBCXX_VISIBILITY(default)
1572 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1585 template<
typename _Tp>
1590 const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
1594 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1595 inline __complex__
float 1596 __complex_acos(__complex__
float __z)
1597 {
return __builtin_cacosf(__z); }
1599 inline __complex__
double 1600 __complex_acos(__complex__
double __z)
1601 {
return __builtin_cacos(__z); }
1603 inline __complex__
long double 1604 __complex_acos(
const __complex__
long double& __z)
1605 {
return __builtin_cacosl(__z); }
1607 template<
typename _Tp>
1610 {
return __complex_acos(__z.__rep()); }
1615 template<
typename _Tp>
1618 {
return __complex_acos(__z); }
1621 template<
typename _Tp>
1630 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1631 inline __complex__
float 1632 __complex_asin(__complex__
float __z)
1633 {
return __builtin_casinf(__z); }
1635 inline __complex__
double 1636 __complex_asin(__complex__
double __z)
1637 {
return __builtin_casin(__z); }
1639 inline __complex__
long double 1640 __complex_asin(
const __complex__
long double& __z)
1641 {
return __builtin_casinl(__z); }
1643 template<
typename _Tp>
1646 {
return __complex_asin(__z.__rep()); }
1651 template<
typename _Tp>
1654 {
return __complex_asin(__z); }
1657 template<
typename _Tp>
1661 const _Tp __r2 = __z.real() * __z.real();
1662 const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
1664 _Tp __num = __z.imag() + _Tp(1.0);
1665 _Tp __den = __z.imag() - _Tp(1.0);
1667 __num = __r2 + __num * __num;
1668 __den = __r2 + __den * __den;
1671 _Tp(0.25) *
log(__num / __den));
1674 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1675 inline __complex__
float 1676 __complex_atan(__complex__
float __z)
1677 {
return __builtin_catanf(__z); }
1679 inline __complex__
double 1680 __complex_atan(__complex__
double __z)
1681 {
return __builtin_catan(__z); }
1683 inline __complex__
long double 1684 __complex_atan(
const __complex__
long double& __z)
1685 {
return __builtin_catanl(__z); }
1687 template<
typename _Tp>
1690 {
return __complex_atan(__z.__rep()); }
1695 template<
typename _Tp>
1698 {
return __complex_atan(__z); }
1701 template<
typename _Tp>
1707 +
std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
1710 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1711 inline __complex__
float 1712 __complex_acosh(__complex__
float __z)
1713 {
return __builtin_cacoshf(__z); }
1715 inline __complex__
double 1716 __complex_acosh(__complex__
double __z)
1717 {
return __builtin_cacosh(__z); }
1719 inline __complex__
long double 1720 __complex_acosh(
const __complex__
long double& __z)
1721 {
return __builtin_cacoshl(__z); }
1723 template<
typename _Tp>
1726 {
return __complex_acosh(__z.__rep()); }
1731 template<
typename _Tp>
1734 {
return __complex_acosh(__z); }
1737 template<
typename _Tp>
1742 * (__z.real() + __z.imag()) + _Tp(1.0),
1743 _Tp(2.0) * __z.real() * __z.imag());
1749 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1750 inline __complex__
float 1751 __complex_asinh(__complex__
float __z)
1752 {
return __builtin_casinhf(__z); }
1754 inline __complex__
double 1755 __complex_asinh(__complex__
double __z)
1756 {
return __builtin_casinh(__z); }
1758 inline __complex__
long double 1759 __complex_asinh(
const __complex__
long double& __z)
1760 {
return __builtin_casinhl(__z); }
1762 template<
typename _Tp>
1765 {
return __complex_asinh(__z.__rep()); }
1770 template<
typename _Tp>
1773 {
return __complex_asinh(__z); }
1776 template<
typename _Tp>
1780 const _Tp __i2 = __z.imag() * __z.imag();
1781 const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
1783 _Tp __num = _Tp(1.0) + __z.real();
1784 _Tp __den = _Tp(1.0) - __z.real();
1786 __num = __i2 + __num * __num;
1787 __den = __i2 + __den * __den;
1790 _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
1793 #if _GLIBCXX_USE_C99_COMPLEX_TR1 1794 inline __complex__
float 1795 __complex_atanh(__complex__
float __z)
1796 {
return __builtin_catanhf(__z); }
1798 inline __complex__
double 1799 __complex_atanh(__complex__
double __z)
1800 {
return __builtin_catanh(__z); }
1802 inline __complex__
long double 1803 __complex_atanh(
const __complex__
long double& __z)
1804 {
return __builtin_catanhl(__z); }
1806 template<
typename _Tp>
1809 {
return __complex_atanh(__z.__rep()); }
1814 template<
typename _Tp>
1817 {
return __complex_atanh(__z); }
1820 template<
typename _Tp>
1829 template<
typename _Tp>
1830 inline typename __gnu_cxx::__promote<_Tp>::__type
1833 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1834 #if (_GLIBCXX11_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) 1835 return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
1842 template<
typename _Tp>
1843 _GLIBCXX_CONSTEXPR
inline typename __gnu_cxx::__promote<_Tp>::__type
1847 template<
typename _Tp>
1848 inline typename __gnu_cxx::__promote<_Tp>::__type
1851 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1852 return __type(__x) * __type(__x);
1855 template<
typename _Tp>
1856 _GLIBCXX_CONSTEXPR
inline typename __gnu_cxx::__promote<_Tp>::__type
1860 template<
typename _Tp,
typename _Up>
1864 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1868 template<
typename _Tp,
typename _Up>
1872 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1876 template<
typename _Tp,
typename _Up>
1880 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1889 template<
typename _Tp>
1893 const _Tp __den = (__z.real() * __z.real()
1894 + __z.imag() * __z.imag() + _Tp(1.0));
1897 (_Tp(2.0) * __z.imag()) / __den);
1900 #if _GLIBCXX_USE_C99_COMPLEX 1901 inline __complex__
float 1902 __complex_proj(__complex__
float __z)
1903 {
return __builtin_cprojf(__z); }
1905 inline __complex__
double 1906 __complex_proj(__complex__
double __z)
1907 {
return __builtin_cproj(__z); }
1909 inline __complex__
long double 1910 __complex_proj(
const __complex__
long double& __z)
1911 {
return __builtin_cprojl(__z); }
1913 template<
typename _Tp>
1916 {
return __complex_proj(__z.__rep()); }
1918 template<
typename _Tp>
1921 {
return __complex_proj(__z); }
1924 template<
typename _Tp>
1928 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1932 template<
typename _Tp>
1936 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1940 _GLIBCXX_END_NAMESPACE_VERSION
1942 #if __cplusplus > 201103L 1944 inline namespace literals {
1945 inline namespace complex_literals {
1946 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1948 #define __cpp_lib_complex_udls 201309 1951 operator""if(
long double __num)
1955 operator""if(
unsigned long long __num)
1959 operator""i(
long double __num)
1963 operator""i(
unsigned long long __num)
1967 operator""il(
long double __num)
1971 operator""il(
unsigned long long __num)
1974 _GLIBCXX_END_NAMESPACE_VERSION
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
Controlling output for std::string.
fmtflags flags() const
Access to format flags.
complex< _Tp > sinh(const complex< _Tp > &)
Return complex hyperbolic sine of z.
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
locale imbue(const locale &__loc)
Moves to a new locale.
std::complex< _Tp > atan(const std::complex< _Tp > &)
atan(__z) [8.1.4].
26.2.3 complex specializations complex<float> specialization
complex< _Tp > & operator=(const _Tp &)
Assign a scalar to this complex number.
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
complex< _Tp > & operator*=(const _Tp &)
Multiply this complex number by a scalar.
void setstate(iostate __state)
Sets additional flags in the error state.
complex< _Tp > log10(const complex< _Tp > &)
Return complex base 10 logarithm of z.
complex< _Tp > polar(const _Tp &, const _Tp &=0)
Return complex with magnitude rho and angle theta.
complex< _Tp > conj(const complex< _Tp > &)
Return complex conjugate of z.
complex< _Tp > pow(const complex< _Tp > &, int)
Return x to the y'th power.
streamsize precision() const
Flags access.
complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
ISO C++ entities toplevel namespace is std.
26.2.3 complex specializations complex<long double> specialization
constexpr complex(const _Tp &__r=_Tp(), const _Tp &__i=_Tp())
Default constructor. First parameter is x, second parameter is y. Unspecified parameters default to 0...
_Tp norm(const complex< _Tp > &)
Return z magnitude squared.
complex< _Tp > sin(const complex< _Tp > &)
Return complex sine of z.
complex< _Tp > tanh(const complex< _Tp > &)
Return complex hyperbolic tangent of z.
std::complex< _Tp > atanh(const std::complex< _Tp > &)
atanh(__z) [8.1.7].
Template class basic_ostream.
complex< _Tp > & operator/=(const _Tp &)
Divide this complex number by a scalar.
GNU extensions for public use.
_Tp value_type
Value typedef.
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
complex< _Tp > & operator+=(const _Tp &__t)
Add a scalar to this complex number.
complex< _Tp > cosh(const complex< _Tp > &)
Return complex hyperbolic cosine of z.
_Tp fabs(const std::complex< _Tp > &)
fabs(__z) [8.1.8].
std::complex< _Tp > asinh(const std::complex< _Tp > &)
asinh(__z) [8.1.6].
std::complex< _Tp > asin(const std::complex< _Tp > &)
asin(__z) [8.1.3].
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
_Tp arg(const complex< _Tp > &)
Return phase angle of z.
__istream_type & putback(char_type __c)
Unextracting a single character.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
complex< _Tp > cos(const complex< _Tp > &)
Return complex cosine of z.
__string_type str() const
Copying out the string buffer.
26.2.3 complex specializations complex<double> specialization
constexpr complex(const complex< _Up > &__z)
Converting constructor.
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
complex< _Tp > & operator-=(const _Tp &__t)
Subtract a scalar from this complex number.
Template class basic_istream.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
std::complex< _Tp > acos(const std::complex< _Tp > &)
acos(__z) [8.1.2].
std::complex< _Tp > acosh(const std::complex< _Tp > &)
acosh(__z) [8.1.5].