diff options
author | kan <kan@FreeBSD.org> | 2003-07-11 03:42:04 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-07-11 03:42:04 +0000 |
commit | c7bbbdd036d3dd7ae253fb13c9994215af06f073 (patch) | |
tree | ce14546aca3a67fa3440aed52f132bafaf68fe70 /contrib/libstdc++/include/std/std_complex.h | |
parent | b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180 (diff) | |
download | FreeBSD-src-c7bbbdd036d3dd7ae253fb13c9994215af06f073.zip FreeBSD-src-c7bbbdd036d3dd7ae253fb13c9994215af06f073.tar.gz |
Gcc 3.3.1-pre 2003-07-11 C++ support bits.
Diffstat (limited to 'contrib/libstdc++/include/std/std_complex.h')
-rw-r--r-- | contrib/libstdc++/include/std/std_complex.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/contrib/libstdc++/include/std/std_complex.h b/contrib/libstdc++/include/std/std_complex.h index bcfcedd..252070b 100644 --- a/contrib/libstdc++/include/std/std_complex.h +++ b/contrib/libstdc++/include/std/std_complex.h @@ -390,7 +390,7 @@ namespace std __s.flags(__os.flags()); __s.imbue(__os.getloc()); __s.precision(__os.precision()); - __s << '(' << __x.real() << "," << __x.imag() << ')'; + __s << '(' << __x.real() << ',' << __x.imag() << ')'; return __os << __s.str(); } @@ -456,7 +456,7 @@ namespace std inline _Tp norm(const complex<_Tp>& __z) { - return _Norm_helper<__is_floating<_Tp>::_M_type>::_S_do_it(__z); + return _Norm_helper<__is_floating<_Tp>::_M_type && !_GLIBCPP_FAST_MATH>::_S_do_it(__z); } template<typename _Tp> @@ -565,24 +565,30 @@ namespace std } template<typename _Tp> - inline complex<_Tp> + complex<_Tp> pow(const complex<_Tp>& __x, const _Tp& __y) { - return exp(__y * log(__x)); + 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 exp(__y * log(__x)); + return __x == _Tp() ? _Tp() : exp(__y * log(__x)); } template<typename _Tp> inline complex<_Tp> pow(const _Tp& __x, const complex<_Tp>& __y) { - return exp(__y * log(__x)); + return __x == _Tp() + ? _Tp() + : polar(pow(__x, __y.real()), __y.imag() * log(__x)); } // 26.2.3 complex specializations |