diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-26 19:18:24 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-26 19:18:24 +0000 |
| commit | c0cf4ba1d83452fd4e6c9f9d5113900900bc455a (patch) | |
| tree | 1c714aed772d1688bc92edf6c7d871cc35e11712 /libstdc++-v3/include/tr1/cmath | |
| parent | 035e2eea7869c36eac41a060f5530eeadbd5bb61 (diff) | |
| download | ppe42-gcc-c0cf4ba1d83452fd4e6c9f9d5113900900bc455a.tar.gz ppe42-gcc-c0cf4ba1d83452fd4e6c9f9d5113900900bc455a.zip | |
2008-05-26 Paolo Carlini <paolo.carlini@oracle.com>
* include/c_global/cmath (pow(float, int), pow(double, int),
pow(long double, int)): Do not define in C++0x mode, per DR 550.
* include/tr1_impl/cmath (pow): Do not bring in unconditionally
from namespace std.
* include/tr1/cmath (pow(double, double), pow(float, float),
pow(long double, long double), pow(_Tp, _Up)): Define.
* include/tr1/complex (pow): Do not bring in from namespace std.
(pow(const std::complex<_Tp>&, int), pow(const std::complex<_Tp>&,
const _Tp&), pow(const _Tp&, const std::complex<_Tp>&),
pow(const std::complex<_Tp>&, const std::complex<_Tp>&)): Define.
* include/tr1_impl/complex (pow(const std::complex<_Tp>&,
const _Up&), pow(const _Tp&, const std::complex<_Up>&),
pow(const std::complex<_Tp>&, const std::complex<_Up>&)): Always
define.
* doc/xml/manual/intro.xml: Add an entry for DR 550.
* testsuite/26_numerics/headers/cmath/dr550.cc: New.
* testsuite/tr1/8_c_compatibility/cmath/overloads.cc: Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/tr1/cmath')
| -rw-r--r-- | libstdc++-v3/include/tr1/cmath | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index 63e6a2e5fda..a9c5aecf018 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -56,6 +56,34 @@ # undef _GLIBCXX_INCLUDE_AS_TR1 #endif +namespace std +{ +namespace tr1 +{ + // DR 550. What should the return type of pow(float,int) be? + // NB: C++0x and TR1 != C++03. + inline double + pow(double __x, double __y) + { return std::pow(__x, __y); } + + inline float + pow(float __x, float __y) + { return std::pow(__x, __y); } + + inline long double + pow(long double __x, long double __y) + { return std::pow(__x, __y); } + + template<typename _Tp, typename _Up> + inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type + pow(_Tp __x, _Up __y) + { + typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; + return std::pow(__type(__x), __type(__y)); + } +} +} + #include <bits/stl_algobase.h> #include <limits> #include <tr1/type_traits> |

