This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libstdc++ PATCH: Fix PR 10689
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 20 May 2003 08:47:49 +0200
- Subject: libstdc++ PATCH: Fix PR 10689
- Organization: Integrable Solutions
Applied to branch and mainline.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/ChangeLog,v
retrieving revision 1.1464.2.111
diff -p -r1.1464.2.111 ChangeLog
*** ChangeLog 17 May 2003 08:15:30 -0000 1.1464.2.111
--- ChangeLog 20 May 2003 06:44:00 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-05-20 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR libstdc++/10689
+ * include/std/std_complex.h (pow): Tidy.
+
2003-05-17 Nathan Myers <ncm@cantrip.org>
* include/bits/streambuf.tcc (__copy_streambufs): Rewrote.
Index: include/std/std_complex.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_complex.h,v
retrieving revision 1.3.2.1
diff -p -r1.3.2.1 std_complex.h
*** include/std/std_complex.h 22 Mar 2003 04:51:35 -0000 1.3.2.1
--- include/std/std_complex.h 20 May 2003 06:44:00 -0000
*************** namespace std
*** 565,588 ****
}
template<typename _Tp>
! inline complex<_Tp>
pow(const complex<_Tp>& __x, const _Tp& __y)
{
! return exp(__y * log(__x));
}
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
! return exp(__y * log(__x));
}
template<typename _Tp>
inline complex<_Tp>
pow(const _Tp& __x, const complex<_Tp>& __y)
{
! return exp(__y * log(__x));
}
// 26.2.3 complex specializations
--- 565,594 ----
}
template<typename _Tp>
! complex<_Tp>
pow(const complex<_Tp>& __x, const _Tp& __y)
{
! if (__x.imag() == _Tp())
! return pow(__x.real(), __y);
!
! complex<_Tp> __t = log(__x);
! return polar(exp(__y * __t.real()), __y * __t.imag());
}
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
! return __x == _Tp() ? _Tp() : exp(__y * log(__x));
}
template<typename _Tp>
inline complex<_Tp>
pow(const _Tp& __x, const complex<_Tp>& __y)
{
! return __x == _Tp()
! ? _Tp()
! : polar(pow(__x, __y.real()), __y.imag() * log(__x));
}
// 26.2.3 complex specializations
Index: testsuite/26_numerics/complex/pow.C
===================================================================
RCS file: testsuite/26_numerics/complex/pow.C
diff -N testsuite/26_numerics/complex/pow.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/26_numerics/complex/pow.C 20 May 2003 06:44:00 -0000
***************
*** 0 ****
--- 1,14 ----
+ // PR libbstdc++/10689
+ // Origin: Daniel.Levine@jhuaph.edu
+
+ #include <complex>
+ #include <testsuite_hooks.h>
+
+ int main()
+ {
+ std::complex<double> z(0, 1) ;
+
+ VERIFY(pow(z, 1.0/3.0) == 0.0);
+
+ return 0;
+ }