From: Gabriel Dos Reis Date: Tue, 31 Oct 2000 20:49:01 +0000 (+0000) Subject: std_complex.h (norm): Forward declare. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99fa3f5eddb9b963d43c55444705af6c2e3daf4a;p=gcc.git std_complex.h (norm): Forward declare. * include/bits/std_complex.h (norm): Forward declare. (complex<>): Comment out friend declaration of conj<>. (conj<>): Comment out specialization. (exp, log, log10): Define primary templates. * src/complex.cc (exp<>, log<>, log10<>): Comment out specializations. From-SVN: r37165 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1461b879544..3d373ed00dc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2000-10-31 Gabriel Dos Reis + + * include/bits/std_complex.h (norm): Forward declare. + (complex<>): Comment out friend declaration of conj<>. + (conj<>): Comment out specialization. + (exp, log, log10): Define primary templates. + + * src/complex.cc (exp<>, log<>, log10<>): Comment out + specializations. + 2000-10-31 Benjamin Kosnik * include/bits/std_complex.h: Remove duplicate definition of conj. diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h index 576ae86163b..f82deb7b219 100644 --- a/libstdc++-v3/include/bits/std_complex.h +++ b/libstdc++-v3/include/bits/std_complex.h @@ -51,6 +51,7 @@ namespace std template _Tp abs(const complex<_Tp>&); template _Tp arg(const complex<_Tp>&); + template _Tp norm(const complex<_Tp>&); template complex<_Tp> conj(const complex<_Tp>&); template complex<_Tp> polar(const _Tp&, const _Tp&); @@ -177,7 +178,8 @@ namespace std friend class complex; // friend float abs<>(const complex&); - friend complex conj<>(const complex&); + //friend complex conj<>(const complex&); + friend complex cos<>(const complex&); friend complex cosh<>(const complex&); friend complex exp<>(const complex&); @@ -251,7 +253,7 @@ namespace std friend class complex; // friend double abs<>(const complex&); - friend complex conj<>(const complex&); + // friend complex conj<>(const complex&); friend complex cos<>(const complex&); friend complex cosh<>(const complex&); friend complex exp<>(const complex&); @@ -326,7 +328,7 @@ namespace std friend class complex; // friend long double abs<>(const complex&); - friend complex conj<>(const complex&); + //friend complex conj<>(const complex&); friend complex cos<>(const complex&); friend complex cosh<>(const complex&); friend complex exp<>(const complex&); @@ -939,35 +941,40 @@ namespace std polar(const _Tp& __rho, const _Tp& __theta) { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } - // 26.2.7/6 +// // We use here a few more specializations. +// template<> +// inline complex +// conj(const complex &__x) +// #ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX +// { +// complex __tmpf(~__x._M_value); +// return __tmpf; +// } +// #else +// { return complex(~__x._M_value); } +// #endif + +// template<> +// inline complex +// conj(const complex &__x) +// { return complex (~__x._M_value); } + + // Transcendentals: template inline complex<_Tp> - conj(const complex<_Tp>& __z) - { return complex<_Tp>(__z.real(), -__z.imag()); } - - // We use here a few more specializations. - template<> - inline complex - conj(const complex &__x) -#ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX - { - complex __tmpf(~__x._M_value); - return __tmpf; - } -#else - { return complex(~__x._M_value); } -#endif - - template<> - inline complex - conj(const complex &__x) - { return complex (~__x._M_value); } + exp(const complex<_Tp>& __z) + { return polar(exp(__z.real()), __z.imag()); } - template<> - inline complex - conj(const complex &__x) - { return complex (~__x._M_value); } + template + inline complex<_Tp> + log(const complex<_Tp>& __z) + { return complex<_Tp>(log(abs(__z)), arg(__z)); } + template + inline complex<_Tp> + log10(const complex<_Tp>& __z) + { return log(__z) / log(_Tp(10.0)); } + } // namespace std #endif /* _CPP_COMPLEX */ diff --git a/libstdc++-v3/src/complex.cc b/libstdc++-v3/src/complex.cc index d1c5df237d4..381f73c40a5 100644 --- a/libstdc++-v3/src/complex.cc +++ b/libstdc++-v3/src/complex.cc @@ -86,20 +86,20 @@ namespace std cosh(const complex& __x) { return complex(ccosh(__x._M_value)); } - template<> - complex - exp(const complex& __x) - { return complex(cexp(__x._M_value)); } +// template<> +// complex +// exp(const complex& __x) +// { return complex(cexp(__x._M_value)); } - template<> - complex - log(const complex& __x) - { return complex(c_log(__x._M_value)); } +// template<> +// complex +// log(const complex& __x) +// { return complex(c_log(__x._M_value)); } - template<> - complex - log10(const complex& __x) - { return complex(clog10(__x._M_value)); } +// template<> +// complex +// log10(const complex& __x) +// { return complex(clog10(__x._M_value)); } template<> complex