36 #ifndef _GLIBCXX_COMPLEX
37 #define _GLIBCXX_COMPLEX 1
39 #pragma GCC system_header
47 namespace std _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 template<>
class complex<float>;
62 template<>
class complex<double>;
63 template<>
class complex<long double>;
88 #ifndef __GXX_EXPERIMENTAL_CXX0X__
121 template<
typename _Tp>
129 _GLIBCXX_CONSTEXPR
complex(
const _Tp& __r = _Tp(),
const _Tp& __i = _Tp())
130 : _M_real(__r), _M_imag(__i) { }
135 template<
typename _Up>
137 : _M_real(__z.real()), _M_imag(__z.imag()) { }
139 #ifdef __GXX_EXPERIMENTAL_CXX0X__
143 real() {
return _M_real; }
146 imag() {
return _M_imag; }
150 real() {
return _M_real; }
154 real()
const {
return _M_real; }
158 imag() {
return _M_imag; }
162 imag()
const {
return _M_imag; }
168 real(_Tp __val) { _M_real = __val; }
171 imag(_Tp __val) { _M_imag = __val; }
203 template<
typename _Up>
206 template<
typename _Up>
209 template<
typename _Up>
212 template<
typename _Up>
215 template<
typename _Up>
218 _GLIBCXX_USE_CONSTEXPR
complex __rep()
const
226 template<
typename _Tp>
236 template<
typename _Tp>
246 template<
typename _Tp>
255 template<
typename _Tp>
256 template<
typename _Up>
260 _M_real = __z.real();
261 _M_imag = __z.imag();
266 template<
typename _Tp>
267 template<
typename _Up>
271 _M_real += __z.real();
272 _M_imag += __z.imag();
277 template<
typename _Tp>
278 template<
typename _Up>
282 _M_real -= __z.real();
283 _M_imag -= __z.imag();
289 template<
typename _Tp>
290 template<
typename _Up>
294 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
295 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
302 template<
typename _Tp>
303 template<
typename _Up>
307 const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
309 _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
317 template<
typename _Tp>
326 template<
typename _Tp>
335 template<
typename _Tp>
347 template<
typename _Tp>
356 template<
typename _Tp>
365 template<
typename _Tp>
377 template<
typename _Tp>
386 template<
typename _Tp>
395 template<
typename _Tp>
407 template<
typename _Tp>
416 template<
typename _Tp>
425 template<
typename _Tp>
436 template<
typename _Tp>
442 template<
typename _Tp>
449 template<
typename _Tp>
450 inline _GLIBCXX_CONSTEXPR
bool
452 {
return __x.real() == __y.real() && __x.imag() == __y.imag(); }
454 template<
typename _Tp>
455 inline _GLIBCXX_CONSTEXPR
bool
457 {
return __x.real() == __y && __x.imag() == _Tp(); }
459 template<
typename _Tp>
460 inline _GLIBCXX_CONSTEXPR
bool
462 {
return __x == __y.real() && _Tp() == __y.imag(); }
467 template<
typename _Tp>
468 inline _GLIBCXX_CONSTEXPR
bool
470 {
return __x.real() != __y.real() || __x.imag() != __y.imag(); }
472 template<
typename _Tp>
473 inline _GLIBCXX_CONSTEXPR
bool
475 {
return __x.real() != __y || __x.imag() != _Tp(); }
477 template<
typename _Tp>
478 inline _GLIBCXX_CONSTEXPR
bool
480 {
return __x != __y.real() || _Tp() != __y.imag(); }
484 template<
typename _Tp,
typename _CharT,
class _Traits>
485 basic_istream<_CharT, _Traits>&
493 __is >> __re_x >> __ch;
496 __is >> __im_x >> __ch;
502 else if (__ch ==
')')
517 template<
typename _Tp,
typename _CharT,
class _Traits>
518 basic_ostream<_CharT, _Traits>&
519 operator<<(basic_ostream<_CharT, _Traits>& __os,
const complex<_Tp>& __x)
522 __s.
flags(__os.flags());
523 __s.
imbue(__os.getloc());
525 __s <<
'(' << __x.real() <<
',' << __x.imag() <<
')';
526 return __os << __s.
str();
530 #ifdef __GXX_EXPERIMENTAL_CXX0X__
531 template<
typename _Tp>
533 real(
const complex<_Tp>& __z)
534 {
return __z.real(); }
536 template<
typename _Tp>
538 imag(
const complex<_Tp>& __z)
539 {
return __z.imag(); }
541 template<
typename _Tp>
543 real(complex<_Tp>& __z)
544 {
return __z.real(); }
546 template<
typename _Tp>
548 real(
const complex<_Tp>& __z)
549 {
return __z.real(); }
551 template<
typename _Tp>
553 imag(complex<_Tp>& __z)
554 {
return __z.imag(); }
556 template<
typename _Tp>
558 imag(
const complex<_Tp>& __z)
559 {
return __z.imag(); }
563 template<
typename _Tp>
565 __complex_abs(
const complex<_Tp>& __z)
567 _Tp __x = __z.real();
568 _Tp __y = __z.imag();
574 return __s *
sqrt(__x * __x + __y * __y);
577 #if _GLIBCXX_USE_C99_COMPLEX
579 __complex_abs(__complex__
float __z) {
return __builtin_cabsf(__z); }
582 __complex_abs(__complex__
double __z) {
return __builtin_cabs(__z); }
585 __complex_abs(
const __complex__
long double& __z)
586 {
return __builtin_cabsl(__z); }
588 template<
typename _Tp>
590 abs(
const complex<_Tp>& __z) {
return __complex_abs(__z.__rep()); }
592 template<
typename _Tp>
599 template<
typename _Tp>
601 __complex_arg(
const complex<_Tp>& __z)
602 {
return atan2(__z.imag(), __z.real()); }
604 #if _GLIBCXX_USE_C99_COMPLEX
606 __complex_arg(__complex__
float __z) {
return __builtin_cargf(__z); }
609 __complex_arg(__complex__
double __z) {
return __builtin_carg(__z); }
612 __complex_arg(
const __complex__
long double& __z)
613 {
return __builtin_cargl(__z); }
615 template<
typename _Tp>
617 arg(
const complex<_Tp>& __z) {
return __complex_arg(__z.__rep()); }
619 template<
typename _Tp>
632 template<
typename _Tp>
633 static inline _Tp _S_do_it(
const complex<_Tp>& __z)
635 const _Tp __x = __z.real();
636 const _Tp __y = __z.imag();
637 return __x * __x + __y * __y;
642 struct _Norm_helper<true>
644 template<
typename _Tp>
645 static inline _Tp _S_do_it(
const complex<_Tp>& __z)
648 return __res * __res;
652 template<
typename _Tp>
656 return _Norm_helper<__is_floating<_Tp>::__value
657 && !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
660 template<
typename _Tp>
662 polar(
const _Tp& __rho,
const _Tp& __theta)
665 template<
typename _Tp>
673 template<
typename _Tp>
675 __complex_cos(
const complex<_Tp>& __z)
677 const _Tp __x = __z.real();
678 const _Tp __y = __z.imag();
682 #if _GLIBCXX_USE_C99_COMPLEX
683 inline __complex__
float
684 __complex_cos(__complex__
float __z) {
return __builtin_ccosf(__z); }
686 inline __complex__
double
687 __complex_cos(__complex__
double __z) {
return __builtin_ccos(__z); }
689 inline __complex__
long double
690 __complex_cos(
const __complex__
long double& __z)
691 {
return __builtin_ccosl(__z); }
693 template<
typename _Tp>
695 cos(
const complex<_Tp>& __z) {
return __complex_cos(__z.__rep()); }
697 template<
typename _Tp>
703 template<
typename _Tp>
705 __complex_cosh(
const complex<_Tp>& __z)
707 const _Tp __x = __z.real();
708 const _Tp __y = __z.imag();
712 #if _GLIBCXX_USE_C99_COMPLEX
713 inline __complex__
float
714 __complex_cosh(__complex__
float __z) {
return __builtin_ccoshf(__z); }
716 inline __complex__
double
717 __complex_cosh(__complex__
double __z) {
return __builtin_ccosh(__z); }
719 inline __complex__
long double
720 __complex_cosh(
const __complex__
long double& __z)
721 {
return __builtin_ccoshl(__z); }
723 template<
typename _Tp>
725 cosh(
const complex<_Tp>& __z) {
return __complex_cosh(__z.__rep()); }
727 template<
typename _Tp>
733 template<
typename _Tp>
735 __complex_exp(
const complex<_Tp>& __z)
738 #if _GLIBCXX_USE_C99_COMPLEX
739 inline __complex__
float
740 __complex_exp(__complex__
float __z) {
return __builtin_cexpf(__z); }
742 inline __complex__
double
743 __complex_exp(__complex__
double __z) {
return __builtin_cexp(__z); }
745 inline __complex__
long double
746 __complex_exp(
const __complex__
long double& __z)
747 {
return __builtin_cexpl(__z); }
749 template<
typename _Tp>
751 exp(
const complex<_Tp>& __z) {
return __complex_exp(__z.__rep()); }
753 template<
typename _Tp>
760 template<
typename _Tp>
762 __complex_log(
const complex<_Tp>& __z)
765 #if _GLIBCXX_USE_C99_COMPLEX
766 inline __complex__
float
767 __complex_log(__complex__
float __z) {
return __builtin_clogf(__z); }
769 inline __complex__
double
770 __complex_log(__complex__
double __z) {
return __builtin_clog(__z); }
772 inline __complex__
long double
773 __complex_log(
const __complex__
long double& __z)
774 {
return __builtin_clogl(__z); }
776 template<
typename _Tp>
778 log(
const complex<_Tp>& __z) {
return __complex_log(__z.__rep()); }
780 template<
typename _Tp>
785 template<
typename _Tp>
791 template<
typename _Tp>
793 __complex_sin(
const complex<_Tp>& __z)
795 const _Tp __x = __z.real();
796 const _Tp __y = __z.imag();
800 #if _GLIBCXX_USE_C99_COMPLEX
801 inline __complex__
float
802 __complex_sin(__complex__
float __z) {
return __builtin_csinf(__z); }
804 inline __complex__
double
805 __complex_sin(__complex__
double __z) {
return __builtin_csin(__z); }
807 inline __complex__
long double
808 __complex_sin(
const __complex__
long double& __z)
809 {
return __builtin_csinl(__z); }
811 template<
typename _Tp>
813 sin(
const complex<_Tp>& __z) {
return __complex_sin(__z.__rep()); }
815 template<
typename _Tp>
821 template<
typename _Tp>
823 __complex_sinh(
const complex<_Tp>& __z)
825 const _Tp __x = __z.real();
826 const _Tp __y = __z.imag();
830 #if _GLIBCXX_USE_C99_COMPLEX
831 inline __complex__
float
832 __complex_sinh(__complex__
float __z) {
return __builtin_csinhf(__z); }
834 inline __complex__
double
835 __complex_sinh(__complex__
double __z) {
return __builtin_csinh(__z); }
837 inline __complex__
long double
838 __complex_sinh(
const __complex__
long double& __z)
839 {
return __builtin_csinhl(__z); }
841 template<
typename _Tp>
843 sinh(
const complex<_Tp>& __z) {
return __complex_sinh(__z.__rep()); }
845 template<
typename _Tp>
852 template<
typename _Tp>
854 __complex_sqrt(
const complex<_Tp>& __z)
856 _Tp __x = __z.real();
857 _Tp __y = __z.imag();
862 return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);
869 ? complex<_Tp>(__u, __y / __t)
870 : complex<_Tp>(
abs(__y) / __t, __y < _Tp() ? -__u : __u);
874 #if _GLIBCXX_USE_C99_COMPLEX
875 inline __complex__
float
876 __complex_sqrt(__complex__
float __z) {
return __builtin_csqrtf(__z); }
878 inline __complex__
double
879 __complex_sqrt(__complex__
double __z) {
return __builtin_csqrt(__z); }
881 inline __complex__
long double
882 __complex_sqrt(
const __complex__
long double& __z)
883 {
return __builtin_csqrtl(__z); }
885 template<
typename _Tp>
887 sqrt(
const complex<_Tp>& __z) {
return __complex_sqrt(__z.__rep()); }
889 template<
typename _Tp>
896 template<
typename _Tp>
898 __complex_tan(
const complex<_Tp>& __z)
901 #if _GLIBCXX_USE_C99_COMPLEX
902 inline __complex__
float
903 __complex_tan(__complex__
float __z) {
return __builtin_ctanf(__z); }
905 inline __complex__
double
906 __complex_tan(__complex__
double __z) {
return __builtin_ctan(__z); }
908 inline __complex__
long double
909 __complex_tan(
const __complex__
long double& __z)
910 {
return __builtin_ctanl(__z); }
912 template<
typename _Tp>
914 tan(
const complex<_Tp>& __z) {
return __complex_tan(__z.__rep()); }
916 template<
typename _Tp>
924 template<
typename _Tp>
926 __complex_tanh(
const complex<_Tp>& __z)
929 #if _GLIBCXX_USE_C99_COMPLEX
930 inline __complex__
float
931 __complex_tanh(__complex__
float __z) {
return __builtin_ctanhf(__z); }
933 inline __complex__
double
934 __complex_tanh(__complex__
double __z) {
return __builtin_ctanh(__z); }
936 inline __complex__
long double
937 __complex_tanh(
const __complex__
long double& __z)
938 {
return __builtin_ctanhl(__z); }
940 template<
typename _Tp>
942 tanh(
const complex<_Tp>& __z) {
return __complex_tanh(__z.__rep()); }
944 template<
typename _Tp>
953 #ifndef __GXX_EXPERIMENTAL_CXX0X__
954 template<
typename _Tp>
956 __complex_pow_unsigned(complex<_Tp> __x,
unsigned __n)
958 complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1);
972 template<
typename _Tp>
974 pow(
const complex<_Tp>& __z,
int __n)
977 ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(
unsigned)__n)
978 : std::__complex_pow_unsigned(__z, __n);
982 template<
typename _Tp>
986 #ifndef _GLIBCXX_USE_C99_COMPLEX
990 if (__x.imag() == _Tp() && __x.real() > _Tp())
991 return pow(__x.real(), __y);
997 template<
typename _Tp>
999 __complex_pow(
const complex<_Tp>& __x,
const complex<_Tp>& __y)
1000 {
return __x == _Tp() ? _Tp() : std::
exp(__y * std::
log(__x)); }
1002 #if _GLIBCXX_USE_C99_COMPLEX
1003 inline __complex__
float
1004 __complex_pow(__complex__
float __x, __complex__
float __y)
1005 {
return __builtin_cpowf(__x, __y); }
1007 inline __complex__
double
1008 __complex_pow(__complex__
double __x, __complex__
double __y)
1009 {
return __builtin_cpow(__x, __y); }
1011 inline __complex__
long double
1012 __complex_pow(
const __complex__
long double& __x,
1013 const __complex__
long double& __y)
1014 {
return __builtin_cpowl(__x, __y); }
1016 template<
typename _Tp>
1018 pow(
const complex<_Tp>& __x,
const complex<_Tp>& __y)
1019 {
return __complex_pow(__x.__rep(), __y.__rep()); }
1021 template<
typename _Tp>
1024 {
return __complex_pow(__x, __y); }
1027 template<
typename _Tp>
1032 __y.imag() *
log(__x))
1042 typedef __complex__
float _ComplexT;
1044 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1046 _GLIBCXX_CONSTEXPR
complex(
float __r = 0.0f,
float __i = 0.0f)
1047 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1048 : _M_value{ __r, __i } { }
1051 __real__ _M_value = __r;
1052 __imag__ _M_value = __i;
1059 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1063 real() {
return __real__ _M_value; }
1066 imag() {
return __imag__ _M_value; }
1069 real() {
return __real__ _M_value; }
1072 real()
const {
return __real__ _M_value; }
1075 imag() {
return __imag__ _M_value; }
1078 imag()
const {
return __imag__ _M_value; }
1084 real(
float __val) { __real__ _M_value = __val; }
1087 imag(
float __val) { __imag__ _M_value = __val; }
1128 template<
typename _Tp>
1132 __real__ _M_value = __z.real();
1133 __imag__ _M_value = __z.imag();
1137 template<
typename _Tp>
1141 __real__ _M_value += __z.real();
1142 __imag__ _M_value += __z.imag();
1150 __real__ _M_value -= __z.real();
1151 __imag__ _M_value -= __z.imag();
1160 __real__ __t = __z.real();
1161 __imag__ __t = __z.imag();
1171 __real__ __t = __z.real();
1172 __imag__ __t = __z.imag();
1177 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1189 typedef __complex__
double _ComplexT;
1191 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1193 _GLIBCXX_CONSTEXPR
complex(
double __r = 0.0,
double __i = 0.0)
1194 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1195 : _M_value{ __r, __i } { }
1198 __real__ _M_value = __r;
1199 __imag__ _M_value = __i;
1204 : _M_value(__z.__rep()) { }
1208 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1212 real() {
return __real__ _M_value; }
1215 imag() {
return __imag__ _M_value; }
1218 real() {
return __real__ _M_value; }
1221 real()
const {
return __real__ _M_value; }
1224 imag() {
return __imag__ _M_value; }
1227 imag()
const {
return __imag__ _M_value; }
1233 real(
double __val) { __real__ _M_value = __val; }
1236 imag(
double __val) { __imag__ _M_value = __val; }
1276 template<
typename _Tp>
1280 __real__ _M_value = __z.real();
1281 __imag__ _M_value = __z.imag();
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>
1308 __real__ __t = __z.real();
1309 __imag__ __t = __z.imag();
1314 template<
typename _Tp>
1319 __real__ __t = __z.real();
1320 __imag__ __t = __z.imag();
1325 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1337 typedef __complex__
long double _ComplexT;
1339 _GLIBCXX_CONSTEXPR
complex(_ComplexT __z) : _M_value(__z) { }
1341 _GLIBCXX_CONSTEXPR
complex(
long double __r = 0.0L,
1342 long double __i = 0.0L)
1343 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1344 : _M_value{ __r, __i } { }
1347 __real__ _M_value = __r;
1348 __imag__ _M_value = __i;
1353 : _M_value(__z.__rep()) { }
1356 : _M_value(__z.__rep()) { }
1358 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1361 constexpr
long double
1362 real() {
return __real__ _M_value; }
1364 constexpr
long double
1365 imag() {
return __imag__ _M_value; }
1368 real() {
return __real__ _M_value; }
1371 real()
const {
return __real__ _M_value; }
1374 imag() {
return __imag__ _M_value; }
1377 imag()
const {
return __imag__ _M_value; }
1383 real(
long double __val) { __real__ _M_value = __val; }
1386 imag(
long double __val) { __imag__ _M_value = __val; }
1426 template<
typename _Tp>
1430 __real__ _M_value = __z.real();
1431 __imag__ _M_value = __z.imag();
1435 template<
typename _Tp>
1439 __real__ _M_value += __z.real();
1440 __imag__ _M_value += __z.imag();
1444 template<
typename _Tp>
1448 __real__ _M_value -= __z.real();
1449 __imag__ _M_value -= __z.imag();
1453 template<
typename _Tp>
1458 __real__ __t = __z.real();
1459 __imag__ __t = __z.imag();
1464 template<
typename _Tp>
1469 __real__ __t = __z.real();
1470 __imag__ __t = __z.imag();
1475 _GLIBCXX_USE_CONSTEXPR _ComplexT __rep()
const {
return _M_value; }
1483 inline _GLIBCXX_CONSTEXPR
1485 : _M_value(__z.__rep()) { }
1487 inline _GLIBCXX_CONSTEXPR
1489 : _M_value(__z.__rep()) { }
1491 inline _GLIBCXX_CONSTEXPR
1493 : _M_value(__z.__rep()) { }
1498 #if _GLIBCXX_EXTERN_TEMPLATE
1500 extern template ostream& operator<<(ostream&, const complex<float>&);
1502 extern template ostream& operator<<(ostream&, const complex<double>&);
1504 extern template ostream& operator<<(ostream&, const complex<long double>&);
1506 #ifdef _GLIBCXX_USE_WCHAR_T
1508 extern template wostream& operator<<(wostream&, const complex<float>&);
1510 extern template wostream& operator<<(wostream&, const complex<double>&);
1512 extern template wostream& operator<<(wostream&, const complex<long double>&);
1518 _GLIBCXX_END_NAMESPACE_VERSION
1521 namespace __gnu_cxx _GLIBCXX_VISIBILITY(
default)
1523 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1526 template<
typename _Tp,
typename _Up>
1527 struct __promote_2<std::complex<_Tp>, _Up>
1533 template<
typename _Tp,
typename _Up>
1534 struct __promote_2<_Tp, std::complex<_Up> >
1540 template<
typename _Tp,
typename _Up>
1541 struct __promote_2<std::complex<_Tp>,
std::complex<_Up> >
1547 _GLIBCXX_END_NAMESPACE_VERSION
1550 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1552 namespace std _GLIBCXX_VISIBILITY(default)
1554 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1567 template<
typename _Tp>
1572 const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
1576 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1577 inline __complex__
float
1578 __complex_acos(__complex__
float __z)
1579 {
return __builtin_cacosf(__z); }
1581 inline __complex__
double
1582 __complex_acos(__complex__
double __z)
1583 {
return __builtin_cacos(__z); }
1585 inline __complex__
long double
1586 __complex_acos(
const __complex__
long double& __z)
1587 {
return __builtin_cacosl(__z); }
1589 template<
typename _Tp>
1592 {
return __complex_acos(__z.__rep()); }
1597 template<
typename _Tp>
1600 {
return __complex_acos(__z); }
1603 template<
typename _Tp>
1612 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1613 inline __complex__
float
1614 __complex_asin(__complex__
float __z)
1615 {
return __builtin_casinf(__z); }
1617 inline __complex__
double
1618 __complex_asin(__complex__
double __z)
1619 {
return __builtin_casin(__z); }
1621 inline __complex__
long double
1622 __complex_asin(
const __complex__
long double& __z)
1623 {
return __builtin_casinl(__z); }
1625 template<
typename _Tp>
1628 {
return __complex_asin(__z.__rep()); }
1633 template<
typename _Tp>
1636 {
return __complex_asin(__z); }
1639 template<
typename _Tp>
1643 const _Tp __r2 = __z.real() * __z.real();
1644 const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
1646 _Tp __num = __z.imag() + _Tp(1.0);
1647 _Tp __den = __z.imag() - _Tp(1.0);
1649 __num = __r2 + __num * __num;
1650 __den = __r2 + __den * __den;
1653 _Tp(0.25) *
log(__num / __den));
1656 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1657 inline __complex__
float
1658 __complex_atan(__complex__
float __z)
1659 {
return __builtin_catanf(__z); }
1661 inline __complex__
double
1662 __complex_atan(__complex__
double __z)
1663 {
return __builtin_catan(__z); }
1665 inline __complex__
long double
1666 __complex_atan(
const __complex__
long double& __z)
1667 {
return __builtin_catanl(__z); }
1669 template<
typename _Tp>
1672 {
return __complex_atan(__z.__rep()); }
1677 template<
typename _Tp>
1680 {
return __complex_atan(__z); }
1683 template<
typename _Tp>
1689 +
std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
1692 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1693 inline __complex__
float
1694 __complex_acosh(__complex__
float __z)
1695 {
return __builtin_cacoshf(__z); }
1697 inline __complex__
double
1698 __complex_acosh(__complex__
double __z)
1699 {
return __builtin_cacosh(__z); }
1701 inline __complex__
long double
1702 __complex_acosh(
const __complex__
long double& __z)
1703 {
return __builtin_cacoshl(__z); }
1705 template<
typename _Tp>
1708 {
return __complex_acosh(__z.__rep()); }
1713 template<
typename _Tp>
1716 {
return __complex_acosh(__z); }
1719 template<
typename _Tp>
1724 * (__z.real() + __z.imag()) + _Tp(1.0),
1725 _Tp(2.0) * __z.real() * __z.imag());
1731 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1732 inline __complex__
float
1733 __complex_asinh(__complex__
float __z)
1734 {
return __builtin_casinhf(__z); }
1736 inline __complex__
double
1737 __complex_asinh(__complex__
double __z)
1738 {
return __builtin_casinh(__z); }
1740 inline __complex__
long double
1741 __complex_asinh(
const __complex__
long double& __z)
1742 {
return __builtin_casinhl(__z); }
1744 template<
typename _Tp>
1747 {
return __complex_asinh(__z.__rep()); }
1752 template<
typename _Tp>
1755 {
return __complex_asinh(__z); }
1758 template<
typename _Tp>
1762 const _Tp __i2 = __z.imag() * __z.imag();
1763 const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
1765 _Tp __num = _Tp(1.0) + __z.real();
1766 _Tp __den = _Tp(1.0) - __z.real();
1768 __num = __i2 + __num * __num;
1769 __den = __i2 + __den * __den;
1772 _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
1775 #if _GLIBCXX_USE_C99_COMPLEX_TR1
1776 inline __complex__
float
1777 __complex_atanh(__complex__
float __z)
1778 {
return __builtin_catanhf(__z); }
1780 inline __complex__
double
1781 __complex_atanh(__complex__
double __z)
1782 {
return __builtin_catanh(__z); }
1784 inline __complex__
long double
1785 __complex_atanh(
const __complex__
long double& __z)
1786 {
return __builtin_catanhl(__z); }
1788 template<
typename _Tp>
1791 {
return __complex_atanh(__z.__rep()); }
1796 template<
typename _Tp>
1799 {
return __complex_atanh(__z); }
1802 template<
typename _Tp>
1811 template<
typename _Tp>
1812 inline typename __gnu_cxx::__promote<_Tp>::__type
1815 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1816 #if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
1817 return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
1824 template<
typename _Tp>
1825 inline typename __gnu_cxx::__promote<_Tp>::__type
1829 template<
typename _Tp>
1830 inline typename __gnu_cxx::__promote<_Tp>::__type
1833 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1834 return __type(__x) * __type(__x);
1837 template<
typename _Tp>
1838 inline typename __gnu_cxx::__promote<_Tp>::__type
1842 template<
typename _Tp,
typename _Up>
1846 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1850 template<
typename _Tp,
typename _Up>
1854 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1858 template<
typename _Tp,
typename _Up>
1862 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1871 template<
typename _Tp>
1875 const _Tp __den = (__z.real() * __z.real()
1876 + __z.imag() * __z.imag() + _Tp(1.0));
1879 (_Tp(2.0) * __z.imag()) / __den);
1882 #if _GLIBCXX_USE_C99_COMPLEX
1883 inline __complex__
float
1884 __complex_proj(__complex__
float __z)
1885 {
return __builtin_cprojf(__z); }
1887 inline __complex__
double
1888 __complex_proj(__complex__
double __z)
1889 {
return __builtin_cproj(__z); }
1891 inline __complex__
long double
1892 __complex_proj(
const __complex__
long double& __z)
1893 {
return __builtin_cprojl(__z); }
1895 template<
typename _Tp>
1898 {
return __complex_proj(__z.__rep()); }
1900 template<
typename _Tp>
1903 {
return __complex_proj(__z); }
1907 template<
typename _Tp>
1908 inline typename __gnu_cxx::__promote<_Tp>::__type
1912 template<
typename _Tp>
1913 inline typename __gnu_cxx::__promote<_Tp>::__type
1917 _GLIBCXX_END_NAMESPACE_VERSION
1920 #endif // __GXX_EXPERIMENTAL_CXX0X__
complex< _Tp > polar(const _Tp &, const _Tp &=0)
Return complex with magnitude rho and angle theta.
complex< _Tp > & operator-=(const _Tp &__t)
Subtract t from this complex number.
void setstate(iostate __state)
Sets additional flags in the error state.
complex< _Tp > sin(const complex< _Tp > &)
Return complex sine of z.
constexpr complex(const complex< _Up > &__z)
Copy constructor.
std::complex< _Tp > asinh(const std::complex< _Tp > &)
asinh(__z) [8.1.6].
basic_istream< char > istream
Base class for char input streams.
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
_Tp arg(const complex< _Tp > &)
Return phase angle of z.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
__istream_type & putback(char_type __c)
Unextracting a single character.
std::complex< _Tp > atan(const std::complex< _Tp > &)
atan(__z) [8.1.4].
complex< _Tp > & operator=(const _Tp &)
Assign this complex number to scalar t.
_Tp value_type
Value typedef.
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
complex< _Tp > log10(const complex< _Tp > &)
Return complex base 10 logarithm of z.
std::complex< _Tp > asin(const std::complex< _Tp > &)
asin(__z) [8.1.3].
complex< _Tp > sinh(const complex< _Tp > &)
Return complex hyperbolic sine of z.
complex< _Tp > & operator*=(const _Tp &)
Multiply this complex number by t.
26.2.3 complex specializations complex<long double> specialization
locale imbue(const locale &__loc)
Moves to a new locale.
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
26.2.3 complex specializations complex<double> specialization
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.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
fmtflags flags() const
Access to format flags.
std::complex< _Tp > acos(const std::complex< _Tp > &)
acos(__z) [8.1.2].
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
complex< _Tp > & operator+=(const _Tp &__t)
Add t to this complex number.
complex< _Tp > conj(const complex< _Tp > &)
Return complex conjugate of z.
__string_type str() const
Copying out the string buffer.
streamsize precision() const
Flags access.
std::complex< _Tp > atanh(const std::complex< _Tp > &)
atanh(__z) [8.1.7].
_Tp fabs(const std::complex< _Tp > &)
fabs(__z) [8.1.8].
basic_ostream< char > ostream
Base class for char output streams.
complex< _Tp > pow(const complex< _Tp > &, const _Tp &)
Return x to the y'th power.
_Tp norm(const complex< _Tp > &)
Return z magnitude squared.
bitset< _Nb > operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
Self-explanatory.
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...
std::complex< _Tp > acosh(const std::complex< _Tp > &)
acosh(__z) [8.1.5].
26.2.3 complex specializations complex<float> specialization
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
complex< _Tp > tanh(const complex< _Tp > &)
Return complex hyperbolic tangent of z.
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
complex< _Tp > cosh(const complex< _Tp > &)
Return complex hyperbolic cosine of z.
complex< _Tp > & operator/=(const _Tp &)
Divide this complex number by t.
Controlling output for std::string.This class supports writing to objects of type std::basic_string...
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.