OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR libstdc++/10689
[pf3gnuchains/gcc-fork.git]
/
libstdc++-v3
/
include
/
std
/
std_complex.h
diff --git
a/libstdc++-v3/include/std/std_complex.h
b/libstdc++-v3/include/std/std_complex.h
index
87e4bcb
..
e943f5e
100644
(file)
--- a/
libstdc++-v3/include/std/std_complex.h
+++ b/
libstdc++-v3/include/std/std_complex.h
@@
-565,24
+565,30
@@
namespace std
}
template<typename _Tp>
}
template<typename _Tp>
-
inline
complex<_Tp>
+ complex<_Tp>
pow(const complex<_Tp>& __x, const _Tp& __y)
{
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)
{
}
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)
{
}
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
}
// 26.2.3 complex specializations