aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-08-12 15:40:01 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-08-12 15:40:01 +0000
commite02d979a34621de7e71c821fcf4cfb5cca511e72 (patch)
treed9379343679f7cc33f97a987c5afb6f6d27d0d17
parent6c32ee74491f947dafdce3656c6ec9e48a185fdb (diff)
downloadgcc-e02d979a34621de7e71c821fcf4cfb5cca511e72.zip
gcc-e02d979a34621de7e71c821fcf4cfb5cca511e72.tar.gz
gcc-e02d979a34621de7e71c821fcf4cfb5cca511e72.tar.bz2
cmath (fmod(_Tp, _Up)): Add.
2011-08-12 Paolo Carlini <paolo.carlini@oracle.com> * include/c_global/cmath (fmod(_Tp, _Up)): Add. * include/c_std/cmath: Likewise. From-SVN: r177698
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/c_global/cmath16
-rw-r--r--libstdc++-v3/include/c_std/cmath7
3 files changed, 26 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c52b849..587ddd5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/c_global/cmath (fmod(_Tp, _Up)): Add.
+ * include/c_std/cmath: Likewise.
+
2011-08-11 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/future: constexpr functions are implicitly inline.
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 1eeded8..6711d90 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -282,6 +282,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
fmod(long double __x, long double __y)
{ return __builtin_fmodl(__x, __y); }
+ template<typename _Tp, typename _Up>
+ inline _GLIBCXX_CONSTEXPR
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
+ fmod(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmod(__type(__x), __type(__y));
+ }
+
using ::frexp;
inline _GLIBCXX_CONSTEXPR float
@@ -313,8 +325,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _GLIBCXX_CONSTEXPR
typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
- ldexp(_Tp __x, int __exp)
- { return __builtin_ldexp(__x, __exp); }
+ ldexp(_Tp __x, int __exp)
+ { return __builtin_ldexp(__x, __exp); }
using ::log;
diff --git a/libstdc++-v3/include/c_std/cmath b/libstdc++-v3/include/c_std/cmath
index 13eef40..c367fce 100644
--- a/libstdc++-v3/include/c_std/cmath
+++ b/libstdc++-v3/include/c_std/cmath
@@ -268,6 +268,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
fmod(long double __x, long double __y)
{ return __builtin_fmodl(__x, __y); }
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value
+ && __is_integer<_Up>::__value,
+ double>::__type
+ fmod(_Tp __x, _Up __y)
+ { return __builtin_fmod(__x, __y); }
+
using ::frexp;
inline float