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>;
91 #if __cplusplus < 201103L
124 template<
typename _Tp>
132 _GLIBCXX_CONSTEXPR
complex(
const _Tp& __r = _Tp(),
const _Tp& __i = _Tp())
133 : _M_real(__r), _M_imag(__i) { }
138 template<
typename _Up>
140 : _M_real(__z.real()), _M_imag(__z.imag()) { }
142 #if __cplusplus >= 201103L
145 __attribute ((__abi_tag__ (
"cxx11")))
147 real() {
return _M_real; }
149 __attribute ((__abi_tag__ (
"cxx11")))
151 imag() {
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; }
208 template<
typename _Up>
211 template<
typename _Up>
214 template<
typename _Up>
217 template<
typename _Up>
220 template<
typename _Up>
223 _GLIBCXX_USE_CONSTEXPR
complex __rep()
const
231 template<
typename _Tp>
241 template<
typename _Tp>
251 template<
typename _Tp>
260 template<
typename _Tp>
261 template<
typename _Up>
265 _M_real = __z.real();
266 _M_imag = __z.imag();
271 template<
typename _Tp>
272 template<
typename _Up>
276 _M_real += __z.real();
277 _M_imag += __z.imag();
282 template<
typename _Tp>
283 template<
typename _Up>
287 _M_real -= __z.real();
288 _M_imag -= __z.imag();
294 template<
typename _Tp>
295 template<
typename _Up>
299 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
300 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
307 template<
typename _Tp>
308 template<
typename _Up>
312 const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
314 _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
322 template<
typename _Tp>
331 template<
typename _Tp>
340 template<
typename _Tp>
352 template<
typename _Tp>
361 template<
typename _Tp>
370 template<
typename _Tp>
382 template<
typename _Tp>
391 template<
typename _Tp>
400 template<
typename _Tp>
412 template<
typename _Tp>
421 template<
typename _Tp>
430 template<
typename _Tp>
441 template<
typename _Tp>
447 template<
typename _Tp>
454 template<
typename _Tp>
455 inline _GLIBCXX_CONSTEXPR
bool
457 {
return __x.real() == __y.real() && __x.imag() == __y.imag(); }
459 template<
typename _Tp>
460 inline _GLIBCXX_CONSTEXPR
bool
462 {
return __x.real() == __y && __x.imag() == _Tp(); }
464 template<
typename _Tp>
465 inline _GLIBCXX_CONSTEXPR
bool
467 {
return __x == __y.real() && _Tp() == __y.imag(); }
472 template<
typename _Tp>
473 inline _GLIBCXX_CONSTEXPR
bool
475 {
return __x.real() != __y.real() || __x.imag() != __y.imag(); }
477 template<
typename _Tp>
478 inline _GLIBCXX_CONSTEXPR
bool
480 {
return __x.real() != __y || __x.imag() != _Tp(); }
482 template<
typename _Tp>
483 inline _GLIBCXX_CONSTEXPR
bool
485 {
return __x != __y.real() || _Tp() != __y.imag(); }
489 template<
typename _Tp,
typename _CharT,
class _Traits>
490 basic_istream<_CharT, _Traits>&
498 __is >> __re_x >> __ch;
501 __is >> __im_x >> __ch;
507 else if (__ch ==
')')
522 template<
typename _Tp,
typename _CharT,
class _Traits>
523 basic_ostream<_CharT, _Traits>&
524 operator<<(basic_ostream<_CharT, _Traits>& __os,
const complex<_Tp>& __x)
527 __s.
flags(__os.flags());
528 __s.
imbue(__os.getloc());
530 __s <<
'(' << __x.real() <<
',' << __x.imag() <<
')';
531 return __os << __s.
str();
535 #if __cplusplus >= 201103L
536 template<
typename _Tp>
538 real(
const complex<_Tp>& __z)
539 {
return __z.real(); }
541 template<
typename _Tp>
543 imag(
const complex<_Tp>& __z)
544 {
return __z.imag(); }
546 template<
typename _Tp>
548 real(complex<_Tp>& __z)
549 {
return __z.real(); }
551 template<
typename _Tp>
553 real(
const complex<_Tp>& __z)
554 {
return __z.real(); }
556 template<
typename _Tp>
558 imag(complex<_Tp>& __z)
559 {
return __z.imag(); }
561 template<
typename _Tp>
563 imag(
const complex<_Tp>& __z)
564 {
return __z.imag(); }
568 template<
typename _Tp>
570 __complex_abs(
const complex<_Tp>& __z)
572 _Tp __x = __z.real();
573 _Tp __y = __z.imag();
579 return __s *
sqrt(__x * __x + __y * __y);
582 #if _GLIBCXX_USE_C99_COMPLEX
584 __complex_abs(__complex__
float __z) {
return __builtin_cabsf(__z); }
587 __complex_abs(__complex__
double __z) {
return __builtin_cabs(__z); }
590 __complex_abs(
const __complex__
long double& __z)
591 {
return __builtin_cabsl(__z); }
593 template<
typename _Tp>
595 abs(
const complex<_Tp>& __z) {
return __complex_abs(__z.__rep()); }
597 template<
typename _Tp>
604 template<
typename _Tp>
606 __complex_arg(
const complex<_Tp>& __z)
607 {
return atan2(__z.imag(), __z.real()); }
609 #if _GLIBCXX_USE_C99_COMPLEX
611 __complex_arg(__complex__
float __z) {
return __builtin_cargf(__z); }
614 __complex_arg(__complex__
double __z) {
return __builtin_carg(__z); }
617 __complex_arg(
const __complex__
long double& __z)
618 {
return __builtin_cargl(__z); }
620 template<
typename _Tp>
622 arg(
const complex<_Tp>& __z) {
return __complex_arg(__z.__rep()); }
624 template<
typename _Tp>
637 template<
typename _Tp>
638 static inline _Tp _S_do_it(
const complex<_Tp>& __z)
640 const _Tp __x = __z.real();
641 const _Tp __y = __z.imag();
642 return __x * __x + __y * __y;
647 struct _Norm_helper<true>
649 template<
typename _Tp>
650 static inline _Tp _S_do_it(
const complex<_Tp>& __z)
653 return __res * __res;
657 template<
typename _Tp>
661 return _Norm_helper<__is_floating<_Tp>::__value
662 && !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
665 template<
typename _Tp>
667 polar(
const _Tp& __rho,
const _Tp& __theta)
670 template<
typename _Tp>
678 template<
typename _Tp>
680 __complex_cos(
const complex<_Tp>& __z)
682 const _Tp __x = __z.real();
683 const _Tp __y = __z.imag();
687 #if _GLIBCXX_USE_C99_COMPLEX
688 inline __complex__
float
689 __complex_cos(__complex__
float __z) {
return __builtin_ccosf(__z); }
691 inline __complex__
double
692 __complex_cos(__complex__
double __z) {
return __builtin_ccos(__z); }
694 inline __complex__
long double
695 __complex_cos(
const __complex__
long double& __z)
696 {
return __builtin_ccosl(__z); }
698 template<
typename _Tp>
700 cos(
const complex<_Tp>& __z) {
return __complex_cos(__z.__rep()); }
702 template<
typename _Tp>
708 template<
typename _Tp>
710 __complex_cosh(
const complex<_Tp>& __z)
712 const _Tp __x = __z.real();
713 const _Tp __y = __z.imag();
717 #if _GLIBCXX_USE_C99_COMPLEX
718 inline __complex__
float
719 __complex_cosh(__complex__
float __z) {
return __builtin_ccoshf(__z); }
721 inline __complex__
double
722 __complex_cosh(__complex__
double __z) {
return __builtin_ccosh(__z); }
724 inline __complex__
long double
725 __complex_cosh(
const __complex__
long double& __z)
726 {
return __builtin_ccoshl(__z); }
728 template<
typename _Tp>
730 cosh(
const complex<_Tp>& __z) {
return __complex_cosh(__z.__rep()); }
732 template<
typename _Tp>
738 template<
typename _Tp>
740 __complex_exp(
const complex<_Tp>& __z)
743 #if _GLIBCXX_USE_C99_COMPLEX
744 inline __complex__
float
745 __complex_exp(__complex__
float __z) {
return __builtin_cexpf(__z); }
747 inline __complex__
double
748 __complex_exp(__complex__
double __z) {
return __builtin_cexp(__z); }
750 inline __complex__
long double
751 __complex_exp(
const __complex__
long double& __z)
752 {
return __builtin_cexpl(__z); }
754 template<
typename _Tp>
756 exp(
const complex<_Tp>& __z) {
return __complex_exp(__z.__rep()); }
758 template<
typename _Tp>
765 template<
typename _Tp>
767 __complex_log(
const complex<_Tp>& __z)
770 #if _GLIBCXX_USE_C99_COMPLEX
771 inline __complex__
float
772 __complex_log(__complex__
float __z) {
return __builtin_clogf(__z); }
774 inline __complex__
double
775 __complex_log(__complex__
double __z) {
return __builtin_clog(__z); }
777 inline __complex__
long double
778 __complex_log(
const __complex__
long double& __z)
779 {
return __builtin_clogl(__z); }
781 template<
typename _Tp>
783 log(
const complex<_Tp>& __z) {
return __complex_log(__z.__rep()); }
785 template<
typename _Tp>
790 template<
typename _Tp>
796 template<
typename _Tp>
798 __complex_sin(
const complex<_Tp>& __z)
800 const _Tp __x = __z.real();
801 const _Tp __y = __z.imag();
805 #if _GLIBCXX_USE_C99_COMPLEX
806 inline __complex__
float
807 __complex_sin(__complex__
float __z) {
return __builtin_csinf(__z); }
809 inline __complex__
double
810 __complex_sin(__complex__
double __z) {
return __builtin_csin(__z); }
812 inline __complex__
long double
813 __complex_sin(
const __complex__
long double& __z)
814 {
return __builtin_csinl(__z); }
816 template<
typename _Tp>
818 sin(
const complex<_Tp>& __z) {
return __complex_sin(__z.__rep()); }
820 template<
typename _Tp>
826 template<
typename _Tp>
828 __complex_sinh(
const complex<_Tp>& __z)
830 const _Tp __x = __z.real();
831 const _Tp __y = __z.imag();
835 #if _GLIBCXX_USE_C99_COMPLEX
836 inline __complex__
float
837 __complex_sinh(__complex__
float __z) {
return __builtin_csinhf(__z); }
839 inline __complex__
double
840 __complex_sinh(__complex__
double __z) {
return __builtin_csinh(__z); }
842 inline __complex__
long double
843 __complex_sinh(
const __complex__
long double& __z)
844 {
return __builtin_csinhl(__z); }
846 template<
typename _Tp>
848 sinh(
const complex<_Tp>& __z) {
return __complex_sinh(__z.__rep()); }
850 template<
typename _Tp>
857 template<
typename _Tp>
859 __complex_sqrt(
const complex<_Tp>& __z)
861 _Tp __x = __z.real();
862 _Tp __y = __z.imag();
867 return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);
874 ? complex<_Tp>(__u, __y / __t)
875 : complex<_Tp>(
abs(__y) / __t, __y < _Tp() ? -__u : __u);
879 #if _GLIBCXX_USE_C99_COMPLEX
880 inline __complex__
float
881 __complex_sqrt(__complex__
float __z) {
return __builtin_csqrtf(__z); }
883 inline __complex__
double
884 __complex_sqrt(__complex__
double __z) {
return __builtin_csqrt(__z); }
886 inline __complex__
long double
887 __complex_sqrt(
const __complex__
long double& __z)
888 {
return __builtin_csqrtl(__z); }
890 template<
typename _Tp>
892 sqrt(
const complex<_Tp>& __z) {
return __complex_sqrt(__z.__rep()); }
894 template<
typename _Tp>
901 template<
typename _Tp>
903 __complex_tan(
const complex<_Tp>& __z)
906 #if _GLIBCXX_USE_C99_COMPLEX
907 inline __complex__
float
908 __complex_tan(__complex__
float __z) {
return __builtin_ctanf(__z); }
910 inline __complex__
double
911 __complex_tan(__complex__
double __z) {
return __builtin_ctan(__z); }
913 inline __complex__
long double
914 __complex_tan(
const __complex__
long double& __z)
915 {
return __builtin_ctanl(__z); }
917 template<
typename _Tp>
919 tan(
const complex<_Tp>& __z) {
return __complex_tan(__z.__rep()); }
921 template<
typename _Tp>
929 template<
typename _Tp>
931 __complex_tanh(
const complex<_Tp>& __z)
934 #if _GLIBCXX_USE_C99_COMPLEX
935 inline __complex__
float
936 __complex_tanh(__complex__
float __z) {
return __builtin_ctanhf(__z); }
938 inline __complex__
double
939 __complex_tanh(__complex__
double __z) {
return __builtin_ctanh(__z); }
941 inline __complex__
long double
942 __complex_tanh(
const __complex__
long double& __z)
943 {
return __builtin_ctanhl(__z); }
945 template<
typename _Tp>
947 tanh(
const complex<_Tp>& __z) {
return __complex_tanh(__z.__rep()); }
949 template<
typename _Tp>
958 #if __cplusplus < 201103L
959 template<
typename _Tp>
961 __complex_pow_unsigned(complex<_Tp> __x,
unsigned __n)
963 complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1);
977 template<
typename _Tp>
979 pow(
const complex<_Tp>& __z,
int __n)
982 ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(
unsigned)__n)
983 : std::__complex_pow_unsigned(__z, __n);
987 template<
typename _Tp>
991 #ifndef _GLIBCXX_USE_C99_COMPLEX
995 if (__x.imag() == _Tp() && __x.real() > _Tp())
996 return pow(__x.real(), __y);
1002 template<
typename _Tp>
1004 __complex_pow(
const complex<_Tp>& __x,
const complex<_Tp>& __y)
1005 {
return __x == _Tp() ? _Tp() : std::
exp(__y * std::
log(__x)); }
1007 #if _GLIBCXX_USE_C99_COMPLEX
1008 inline __complex__
float
1009 __complex_pow(__complex__
float __x, __complex__
float __y)
1010 {
return __builtin_cpowf(__x, __y); }
1012 inline __complex__
double
1013 __complex_pow(__complex__
double __x, __complex__
double __y)
1014 {
return __builtin_cpow(__x, __y); }
1016 inline __complex__
long double
1017 __complex_pow(
const __complex__
long double& __x,
1018 const __complex__
long double& __y)
1019 {
return __builtin_cpowl(__x, __y); }
1021 template<
typename _Tp>
1023 pow(
const complex<_Tp>& __x,
const complex<_Tp>& __y)
1024 {
return __complex_pow(__x.__rep(), __y.__rep()); }
1026 template<
typename _Tp>
1029 {
return __complex_pow(__x, __y); }
1032 template<
typename _Tp>
1037 __y.imag() *
log(__x))
1047 typedef __complex__
float _ComplexT;
1049 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1051 _GLIBCXX_CONSTEXPR
complex(
float __r = 0.0f,
float __i = 0.0f)
1052 #if __cplusplus >= 201103L
1053 : _M_value{ __r, __i } { }
1056 __real__ _M_value = __r;
1057 __imag__ _M_value = __i;
1064 #if __cplusplus >= 201103L
1067 __attribute ((__abi_tag__ (
"cxx11")))
1069 real() {
return __real__ _M_value; }
1071 __attribute ((__abi_tag__ (
"cxx11")))
1073 imag() {
return __imag__ _M_value; }
1076 real() {
return __real__ _M_value; }
1079 real()
const {
return __real__ _M_value; }
1082 imag() {
return __imag__ _M_value; }
1085 imag()
const {
return __imag__ _M_value; }
1091 real(
float __val) { __real__ _M_value = __val; }
1094 imag(
float __val) { __imag__ _M_value = __val; }
1135 template<
typename _Tp>
1139 __real__ _M_value = __z.real();
1140 __imag__ _M_value = __z.imag();
1144 template<
typename _Tp>
1148 __real__ _M_value += __z.real();
1149 __imag__ _M_value += __z.imag();
1157 __real__ _M_value -= __z.real();
1158 __imag__ _M_value -= __z.imag();
1167 __real__ __t = __z.real();
1168 __imag__ __t = __z.imag();
1178 __real__ __t = __z.real();
1179 __imag__ __t = __z.imag();
1184 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1196 typedef __complex__
double _ComplexT;
1198 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1200 _GLIBCXX_CONSTEXPR
complex(
double __r = 0.0,
double __i = 0.0)
1201 #if __cplusplus >= 201103L
1202 : _M_value{ __r, __i } { }
1205 __real__ _M_value = __r;
1206 __imag__ _M_value = __i;
1211 : _M_value(__z.__rep()) { }
1215 #if __cplusplus >= 201103L
1218 __attribute ((__abi_tag__ (
"cxx11")))
1220 real() {
return __real__ _M_value; }
1222 __attribute ((__abi_tag__ (
"cxx11")))
1224 imag() {
return __imag__ _M_value; }
1227 real() {
return __real__ _M_value; }
1230 real()
const {
return __real__ _M_value; }
1233 imag() {
return __imag__ _M_value; }
1236 imag()
const {
return __imag__ _M_value; }
1242 real(
double __val) { __real__ _M_value = __val; }
1245 imag(
double __val) { __imag__ _M_value = __val; }
1285 template<
typename _Tp>
1289 __real__ _M_value = __z.real();
1290 __imag__ _M_value = __z.imag();
1294 template<
typename _Tp>
1298 __real__ _M_value += __z.real();
1299 __imag__ _M_value += __z.imag();
1303 template<
typename _Tp>
1307 __real__ _M_value -= __z.real();
1308 __imag__ _M_value -= __z.imag();
1312 template<
typename _Tp>
1317 __real__ __t = __z.real();
1318 __imag__ __t = __z.imag();
1323 template<
typename _Tp>
1328 __real__ __t = __z.real();
1329 __imag__ __t = __z.imag();
1334 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1346 typedef __complex__
long double _ComplexT;
1348 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1350 _GLIBCXX_CONSTEXPR
complex(
long double __r = 0.0L,
1351 long double __i = 0.0L)
1352 #if __cplusplus >= 201103L
1353 : _M_value{ __r, __i } { }
1356 __real__ _M_value = __r;
1357 __imag__ _M_value = __i;
1362 : _M_value(__z.__rep()) { }
1365 : _M_value(__z.__rep()) { }
1367 #if __cplusplus >= 201103L
1370 __attribute ((__abi_tag__ (
"cxx11")))
1371 constexpr
long double
1372 real() {
return __real__ _M_value; }
1374 __attribute ((__abi_tag__ (
"cxx11")))
1375 constexpr
long double
1376 imag() {
return __imag__ _M_value; }
1379 real() {
return __real__ _M_value; }
1382 real()
const {
return __real__ _M_value; }
1385 imag() {
return __imag__ _M_value; }
1388 imag()
const {
return __imag__ _M_value; }
1394 real(
long double __val) { __real__ _M_value = __val; }
1397 imag(
long double __val) { __imag__ _M_value = __val; }
1437 template<
typename _Tp>
1441 __real__ _M_value = __z.real();
1442 __imag__ _M_value = __z.imag();
1446 template<
typename _Tp>
1450 __real__ _M_value += __z.real();
1451 __imag__ _M_value += __z.imag();
1455 template<
typename _Tp>
1459 __real__ _M_value -= __z.real();
1460 __imag__ _M_value -= __z.imag();
1464 template<
typename _Tp>
1469 __real__ __t = __z.real();
1470 __imag__ __t = __z.imag();
1475 template<
typename _Tp>
1480 __real__ __t = __z.real();
1481 __imag__ __t = __z.imag();
1486 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1494 inline _GLIBCXX_CONSTEXPR
1496 : _M_value(__z.__rep()) { }
1498 inline _GLIBCXX_CONSTEXPR
1500 : _M_value(__z.__rep()) { }
1502 inline _GLIBCXX_CONSTEXPR
1504 : _M_value(__z.__rep()) { }
1509 #if _GLIBCXX_EXTERN_TEMPLATE
1511 extern template ostream& operator<<(ostream&, const complex<float>&);
1513 extern template ostream& operator<<(ostream&, const complex<double>&);
1515 extern template ostream& operator<<(ostream&, const complex<long double>&);
1517 #ifdef _GLIBCXX_USE_WCHAR_T
1519 extern template wostream& operator<<(wostream&, const complex<float>&);
1521 extern template wostream& operator<<(wostream&, const complex<double>&);
1523 extern template wostream& operator<<(wostream&, const complex<long double>&);
1529 _GLIBCXX_END_NAMESPACE_VERSION
1532 namespace __gnu_cxx _GLIBCXX_VISIBILITY(
default)
1534 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1537 template<
typename _Tp,
typename _Up>
1538 struct __promote_2<std::complex<_Tp>, _Up>
1544 template<
typename _Tp,
typename _Up>
1545 struct __promote_2<_Tp, std::complex<_Up> >
1551 template<
typename _Tp,
typename _Up>
1552 struct __promote_2<std::complex<_Tp>,
std::complex<_Up> >
1558 _GLIBCXX_END_NAMESPACE_VERSION
1561 #if __cplusplus >= 201103L
1563 namespace std _GLIBCXX_VISIBILITY(default)
1565 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1578 template<
typename _Tp>
1583 const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
1587 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1588 inline __complex__
float
1589 __complex_acos(__complex__
float __z)
1590 {
return __builtin_cacosf(__z); }
1592 inline __complex__
double
1593 __complex_acos(__complex__
double __z)
1594 {
return __builtin_cacos(__z); }
1596 inline __complex__
long double
1597 __complex_acos(
const __complex__
long double& __z)
1598 {
return __builtin_cacosl(__z); }
1600 template<
typename _Tp>
1603 {
return __complex_acos(__z.__rep()); }
1608 template<
typename _Tp>
1611 {
return __complex_acos(__z); }
1614 template<
typename _Tp>
1623 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1624 inline __complex__
float
1625 __complex_asin(__complex__
float __z)
1626 {
return __builtin_casinf(__z); }
1628 inline __complex__
double
1629 __complex_asin(__complex__
double __z)
1630 {
return __builtin_casin(__z); }
1632 inline __complex__
long double
1633 __complex_asin(
const __complex__
long double& __z)
1634 {
return __builtin_casinl(__z); }
1636 template<
typename _Tp>
1639 {
return __complex_asin(__z.__rep()); }
1644 template<
typename _Tp>
1647 {
return __complex_asin(__z); }
1650 template<
typename _Tp>
1654 const _Tp __r2 = __z.real() * __z.real();
1655 const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
1657 _Tp __num = __z.imag() + _Tp(1.0);
1658 _Tp __den = __z.imag() - _Tp(1.0);
1660 __num = __r2 + __num * __num;
1661 __den = __r2 + __den * __den;
1664 _Tp(0.25) *
log(__num / __den));
1667 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1668 inline __complex__
float
1669 __complex_atan(__complex__
float __z)
1670 {
return __builtin_catanf(__z); }
1672 inline __complex__
double
1673 __complex_atan(__complex__
double __z)
1674 {
return __builtin_catan(__z); }
1676 inline __complex__
long double
1677 __complex_atan(
const __complex__
long double& __z)
1678 {
return __builtin_catanl(__z); }
1680 template<
typename _Tp>
1683 {
return __complex_atan(__z.__rep()); }
1688 template<
typename _Tp>
1691 {
return __complex_atan(__z); }
1694 template<
typename _Tp>
1700 +
std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
1703 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1704 inline __complex__
float
1705 __complex_acosh(__complex__
float __z)
1706 {
return __builtin_cacoshf(__z); }
1708 inline __complex__
double
1709 __complex_acosh(__complex__
double __z)
1710 {
return __builtin_cacosh(__z); }
1712 inline __complex__
long double
1713 __complex_acosh(
const __complex__
long double& __z)
1714 {
return __builtin_cacoshl(__z); }
1716 template<
typename _Tp>
1719 {
return __complex_acosh(__z.__rep()); }
1724 template<
typename _Tp>
1727 {
return __complex_acosh(__z); }
1730 template<
typename _Tp>
1735 * (__z.real() + __z.imag()) + _Tp(1.0),
1736 _Tp(2.0) * __z.real() * __z.imag());
1742 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1743 inline __complex__
float
1744 __complex_asinh(__complex__
float __z)
1745 {
return __builtin_casinhf(__z); }
1747 inline __complex__
double
1748 __complex_asinh(__complex__
double __z)
1749 {
return __builtin_casinh(__z); }
1751 inline __complex__
long double
1752 __complex_asinh(
const __complex__
long double& __z)
1753 {
return __builtin_casinhl(__z); }
1755 template<
typename _Tp>
1758 {
return __complex_asinh(__z.__rep()); }
1763 template<
typename _Tp>
1766 {
return __complex_asinh(__z); }
1769 template<
typename _Tp>
1773 const _Tp __i2 = __z.imag() * __z.imag();
1774 const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
1776 _Tp __num = _Tp(1.0) + __z.real();
1777 _Tp __den = _Tp(1.0) - __z.real();
1779 __num = __i2 + __num * __num;
1780 __den = __i2 + __den * __den;
1783 _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
1786 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1787 inline __complex__
float
1788 __complex_atanh(__complex__
float __z)
1789 {
return __builtin_catanhf(__z); }
1791 inline __complex__
double
1792 __complex_atanh(__complex__
double __z)
1793 {
return __builtin_catanh(__z); }
1795 inline __complex__
long double
1796 __complex_atanh(
const __complex__
long double& __z)
1797 {
return __builtin_catanhl(__z); }
1799 template<
typename _Tp>
1802 {
return __complex_atanh(__z.__rep()); }
1807 template<
typename _Tp>
1810 {
return __complex_atanh(__z); }
1813 template<
typename _Tp>
1822 template<
typename _Tp>
1823 inline typename __gnu_cxx::__promote<_Tp>::__type
1826 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1827 #if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
1828 return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
1835 template<
typename _Tp>
1836 inline typename __gnu_cxx::__promote<_Tp>::__type
1840 template<
typename _Tp>
1841 inline typename __gnu_cxx::__promote<_Tp>::__type
1844 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1845 return __type(__x) * __type(__x);
1848 template<
typename _Tp>
1849 inline typename __gnu_cxx::__promote<_Tp>::__type
1853 template<
typename _Tp,
typename _Up>
1857 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1861 template<
typename _Tp,
typename _Up>
1865 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1869 template<
typename _Tp,
typename _Up>
1873 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1882 template<
typename _Tp>
1886 const _Tp __den = (__z.real() * __z.real()
1887 + __z.imag() * __z.imag() + _Tp(1.0));
1890 (_Tp(2.0) * __z.imag()) / __den);
1893 #if _GLIBCXX_USE_C99_COMPLEX
1894 inline __complex__
float
1895 __complex_proj(__complex__
float __z)
1896 {
return __builtin_cprojf(__z); }
1898 inline __complex__
double
1899 __complex_proj(__complex__
double __z)
1900 {
return __builtin_cproj(__z); }
1902 inline __complex__
long double
1903 __complex_proj(
const __complex__
long double& __z)
1904 {
return __builtin_cprojl(__z); }
1906 template<
typename _Tp>
1909 {
return __complex_proj(__z.__rep()); }
1911 template<
typename _Tp>
1914 {
return __complex_proj(__z); }
1918 template<
typename _Tp>
1919 inline typename __gnu_cxx::__promote<_Tp>::__type
1923 template<
typename _Tp>
1924 inline typename __gnu_cxx::__promote<_Tp>::__type
1928 _GLIBCXX_END_NAMESPACE_VERSION