From: Gabriel Dos Reis Date: Tue, 31 Oct 2000 15:54:00 +0000 (+0000) Subject: complex.cc (arg, polar): Comment out specializations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e541461a498d47602918a711290095ed28041355;p=gcc.git complex.cc (arg, polar): Comment out specializations. * src/complex.cc (arg, polar): Comment out specializations. * include/bits/std_complex.h (complex<>): Remove arg<> friend declaration. (arg): Define primary template. (polar): Likewise. (conj): Likewise. From-SVN: r37159 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 416204166e0..ea5cc1d2992 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2000-10-31 Gabriel Dos Reis + + * src/complex.cc (arg, polar): Comment out specializations. + + * include/bits/std_complex.h (complex<>): Remove arg<> friend + declaration. + (arg): Define primary template. + (polar): Likewise. + (conj): Likewise. + 2000-10-31 Gabriel Dos Reis * include/c/bits/std_cwctype.h: #undef possible function-like diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h index 056b12076f4..349d2dc6fd6 100644 --- a/libstdc++-v3/include/bits/std_complex.h +++ b/libstdc++-v3/include/bits/std_complex.h @@ -177,7 +177,6 @@ namespace std friend class complex; // friend float abs<>(const complex&); - friend float arg<>(const complex&); friend complex conj<>(const complex&); @@ -254,7 +253,6 @@ namespace std friend class complex; // friend double abs<>(const complex&); - friend double arg<>(const complex&); friend complex conj<>(const complex&); friend complex cos<>(const complex&); @@ -331,7 +329,6 @@ namespace std friend class complex; // friend long double abs<>(const complex&); - friend long double arg<>(const complex&); friend complex conj<>(const complex&); friend complex cos<>(const complex&); @@ -886,12 +883,12 @@ namespace std template inline bool operator==(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() == __y && __x.imag() == 0; } + { return __x.real() == __y && __x.imag() == _Tp(); } template inline bool operator==(const _Tp& __x, const complex<_Tp>& __y) - { return __x == __y.real() && 0 == __y.imag(); } + { return __x == __y.real() && _Tp() == __y.imag(); } template inline bool @@ -901,12 +898,12 @@ namespace std template inline bool operator!=(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() != __y || __x.imag() != 0; } + { return __x.real() != __y || __x.imag() != _Tp(); } template inline bool operator!=(const _Tp& __x, const complex<_Tp>& __y) - { return __x != __y.real() || 0 != __y.imag(); } + { return __x != __y.real() || _Tp() != __y.imag(); } template basic_istream<_CharT, _Traits>& @@ -940,7 +937,22 @@ namespace std __x /= __s; __y /= __s; return __s * sqrt(__x * __x + __y * __y); } - + + template + inline _Tp + arg(const complex<_Tp>& __z) + { return atan2(__z.imag(), __z.real()); } + + + template + inline complex<_Tp> + polar(const _Tp& __rho, const _Tp& __theta) + { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } + + template + inline complex<_Tp> + conj(const complex<_Tp>& __z) + { return complex<_Tp>(__z.real(), -__z.imag()); } // We use here a few more specializations. template<> diff --git a/libstdc++-v3/src/complex.cc b/libstdc++-v3/src/complex.cc index 2f7cfc48a60..d1c5df237d4 100644 --- a/libstdc++-v3/src/complex.cc +++ b/libstdc++-v3/src/complex.cc @@ -54,27 +54,27 @@ namespace std // return hypot (__real__ __x._M_value, __imag__ __x._M_value); // } - template<> - FLT - arg(const complex& __x) - { return carg(__x._M_value); } +// template<> +// FLT +// arg(const complex& __x) +// { return carg(__x._M_value); } - template<> - complex - polar(const FLT& __rho, const FLT& __theta) - { -#if 0 -// XXX -// defined(_GLIBCPP_HAVE_SINCOS) && !defined(__osf__) - // Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it - // since the necessary types are not defined in the headers. - FLT __sinx, __cosx; - sincos(__theta, &__sinx, &__cosx); - return complex(__rho * __cosx, __rho * __sinx); -#else - return complex(__rho * cos(__theta), __rho * sin(__theta)); -#endif - } +// template<> +// complex +// polar(const FLT& __rho, const FLT& __theta) +// { +// #if 0 +// // XXX +// // defined(_GLIBCPP_HAVE_SINCOS) && !defined(__osf__) +// // Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it +// // since the necessary types are not defined in the headers. +// FLT __sinx, __cosx; +// sincos(__theta, &__sinx, &__cosx); +// return complex(__rho * __cosx, __rho * __sinx); +// #else +// return complex(__rho * cos(__theta), __rho * sin(__theta)); +// #endif +// } template<> complex @@ -147,8 +147,3 @@ namespace std { return complex(ctanh(__x._M_value)); } } // namespace std - - - - -