summaryrefslogtreecommitdiff
path: root/contrib/libstdc++/include/std/std_complex.h
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2003-07-11 03:42:04 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2003-07-11 03:42:04 +0000
commit1b86b14eacf30b52bd5b9e48116db15982432eda (patch)
treece14546aca3a67fa3440aed52f132bafaf68fe70 /contrib/libstdc++/include/std/std_complex.h
parentbd0df3aa27aac083bd60b649fa5347076a5126eb (diff)
Notes
Diffstat (limited to 'contrib/libstdc++/include/std/std_complex.h')
-rw-r--r--contrib/libstdc++/include/std/std_complex.h18
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 bcfcedde8e9a..252070b13895 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