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
This commit is contained in:
parent
93cc1c6995
commit
99fa3f5edd
3 changed files with 57 additions and 40 deletions
|
@ -1,3 +1,13 @@
|
|||
2000-10-31 Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
|
||||
* 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 <bkoz@purist.soma.redhat.com>
|
||||
|
||||
* include/bits/std_complex.h: Remove duplicate definition of conj.
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace std
|
|||
|
||||
template<typename _Tp> _Tp abs(const complex<_Tp>&);
|
||||
template<typename _Tp> _Tp arg(const complex<_Tp>&);
|
||||
template<typename _Tp> _Tp norm(const complex<_Tp>&);
|
||||
|
||||
template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
|
||||
template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp&);
|
||||
|
@ -177,7 +178,8 @@ namespace std
|
|||
friend class complex<long double>;
|
||||
|
||||
// friend float abs<>(const complex<float>&);
|
||||
friend complex<float> conj<>(const complex<float>&);
|
||||
//friend complex<float> conj<>(const complex<float>&);
|
||||
|
||||
friend complex<float> cos<>(const complex<float>&);
|
||||
friend complex<float> cosh<>(const complex<float>&);
|
||||
friend complex<float> exp<>(const complex<float>&);
|
||||
|
@ -251,7 +253,7 @@ namespace std
|
|||
friend class complex<long double>;
|
||||
|
||||
// friend double abs<>(const complex<double>&);
|
||||
friend complex<double> conj<>(const complex<double>&);
|
||||
// friend complex<double> conj<>(const complex<double>&);
|
||||
friend complex<double> cos<>(const complex<double>&);
|
||||
friend complex<double> cosh<>(const complex<double>&);
|
||||
friend complex<double> exp<>(const complex<double>&);
|
||||
|
@ -326,7 +328,7 @@ namespace std
|
|||
friend class complex<double>;
|
||||
|
||||
// friend long double abs<>(const complex<long double>&);
|
||||
friend complex<long double> conj<>(const complex<long double>&);
|
||||
//friend complex<long double> conj<>(const complex<long double>&);
|
||||
friend complex<long double> cos<>(const complex<long double>&);
|
||||
friend complex<long double> cosh<>(const complex<long double>&);
|
||||
friend complex<long double> exp<>(const complex<long double>&);
|
||||
|
@ -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<float>
|
||||
// conj(const complex<float> &__x)
|
||||
// #ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX
|
||||
// {
|
||||
// complex<float> __tmpf(~__x._M_value);
|
||||
// return __tmpf;
|
||||
// }
|
||||
// #else
|
||||
// { return complex<float>(~__x._M_value); }
|
||||
// #endif
|
||||
|
||||
// template<>
|
||||
// inline complex<double>
|
||||
// conj(const complex<double> &__x)
|
||||
// { return complex<double> (~__x._M_value); }
|
||||
|
||||
// Transcendentals:
|
||||
template<typename _Tp>
|
||||
inline complex<_Tp>
|
||||
conj(const complex<_Tp>& __z)
|
||||
{ return complex<_Tp>(__z.real(), -__z.imag()); }
|
||||
exp(const complex<_Tp>& __z)
|
||||
{ return polar(exp(__z.real()), __z.imag()); }
|
||||
|
||||
// We use here a few more specializations.
|
||||
template<>
|
||||
inline complex<float>
|
||||
conj(const complex<float> &__x)
|
||||
#ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX
|
||||
{
|
||||
complex<float> __tmpf(~__x._M_value);
|
||||
return __tmpf;
|
||||
}
|
||||
#else
|
||||
{ return complex<float>(~__x._M_value); }
|
||||
#endif
|
||||
|
||||
template<>
|
||||
inline complex<double>
|
||||
conj(const complex<double> &__x)
|
||||
{ return complex<double> (~__x._M_value); }
|
||||
|
||||
template<>
|
||||
inline complex<long double>
|
||||
conj(const complex<long double> &__x)
|
||||
{ return complex<long double> (~__x._M_value); }
|
||||
template<typename _Tp>
|
||||
inline complex<_Tp>
|
||||
log(const complex<_Tp>& __z)
|
||||
{ return complex<_Tp>(log(abs(__z)), arg(__z)); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline complex<_Tp>
|
||||
log10(const complex<_Tp>& __z)
|
||||
{ return log(__z) / log(_Tp(10.0)); }
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif /* _CPP_COMPLEX */
|
||||
|
|
|
@ -86,20 +86,20 @@ namespace std
|
|||
cosh(const complex<FLT>& __x)
|
||||
{ return complex<FLT>(ccosh(__x._M_value)); }
|
||||
|
||||
template<>
|
||||
complex<FLT>
|
||||
exp(const complex<FLT>& __x)
|
||||
{ return complex<FLT>(cexp(__x._M_value)); }
|
||||
// template<>
|
||||
// complex<FLT>
|
||||
// exp(const complex<FLT>& __x)
|
||||
// { return complex<FLT>(cexp(__x._M_value)); }
|
||||
|
||||
template<>
|
||||
complex<FLT>
|
||||
log(const complex<FLT>& __x)
|
||||
{ return complex<FLT>(c_log(__x._M_value)); }
|
||||
// template<>
|
||||
// complex<FLT>
|
||||
// log(const complex<FLT>& __x)
|
||||
// { return complex<FLT>(c_log(__x._M_value)); }
|
||||
|
||||
template<>
|
||||
complex<FLT>
|
||||
log10(const complex<FLT>& __x)
|
||||
{ return complex<FLT>(clog10(__x._M_value)); }
|
||||
// template<>
|
||||
// complex<FLT>
|
||||
// log10(const complex<FLT>& __x)
|
||||
// { return complex<FLT>(clog10(__x._M_value)); }
|
||||
|
||||
template<>
|
||||
complex<FLT>
|
||||
|
|
Loading…
Add table
Reference in a new issue