This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix a trivial bug in complex pow


Hi,

noticed today while trying to make (consistent) sense out of
various corner cases (more about that later): seems just a bit
left off the recent reorganization. Will wait a bit just in
case...

Tested x86-linux.

Paolo.

//////////////
2005-03-07  Paolo Carlini  <pcarlini@suse.de>

	* include/std/std_complex.h (pow(const complex<_Tp>&,
	const complex<_Tp>&)): Dispatch to either __complex_pow(__x.__rep(),
	__y.__rep()) or __complex_pow(__x, __y) depending on the macro
	_GLIBCXX_USE_C99_COMPLEX.
diff -urN libstdc++-v3-orig/include/std/std_complex.h libstdc++-v3/include/std/std_complex.h
--- libstdc++-v3-orig/include/std/std_complex.h	2005-02-24 19:55:51.000000000 +0100
+++ libstdc++-v3/include/std/std_complex.h	2005-03-07 17:36:30.000000000 +0100
@@ -966,14 +966,20 @@
   { return __builtin_cpow(__x, __y); }
 
   inline __complex__ long double
-  __complex_pow(__complex__ long double& __x, __complex__ long double& __y)
+  __complex_pow(const __complex__ long double& __x,
+		const __complex__ long double& __y)
   { return __builtin_cpowl(__x, __y); }
-#endif
 
   template<typename _Tp>
     inline complex<_Tp>
     pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
+    { return __complex_pow(__x.__rep(), __y.__rep()); }
+#else
+  template<typename _Tp>
+    inline complex<_Tp>
+    pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
     { return __complex_pow(__x, __y); }
+#endif
 
   template<typename _Tp>
     inline complex<_Tp>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]