aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-10-01 23:10:02 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-10-01 23:10:02 +0000
commitdecf0e27a018bd3c5fafee44c5f6aead8fc8cc9c (patch)
treea4c316e8f4ffabb8e3a5c7bb7536fb6b6d073aa7 /libstdc++-v3
parent6b391f493762d0e97ce9d8eb7602334af1ba1f45 (diff)
downloadgcc-decf0e27a018bd3c5fafee44c5f6aead8fc8cc9c.zip
gcc-decf0e27a018bd3c5fafee44c5f6aead8fc8cc9c.tar.gz
gcc-decf0e27a018bd3c5fafee44c5f6aead8fc8cc9c.tar.bz2
re PR libstdc++/54757 (FAIL: ext/random/beta_distribution/cons/default.cc (test for excess errors))
2012-10-01 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/54757 * include/ext/random (rice_distribution<>::operator()): Use std::hypot only if _GLIBCXX_USE_C99_MATH_TR1. * include/ext/random.tcc (rice_distribution<>::__generate_impl): Likewise. From-SVN: r191944
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/ext/random8
-rw-r--r--libstdc++-v3/include/ext/random.tcc4
3 files changed, 20 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8fd82e7..8eb1480 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/54757
+ * include/ext/random (rice_distribution<>::operator()): Use std::hypot
+ only if _GLIBCXX_USE_C99_MATH_TR1.
+ * include/ext/random.tcc (rice_distribution<>::__generate_impl):
+ Likewise.
+
2012-10-01 Daniel Krugler <daniel.kruegler@googlemail.com>
* include/std/type_traits (result_of): Provide "SFINAE-friendly"
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 884e8a0..8c40d6d 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -1042,7 +1042,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
result_type __x = this->_M_ndx(__urng);
result_type __y = this->_M_ndy(__urng);
+#if _GLIBCXX_USE_C99_MATH_TR1
return std::hypot(__x, __y);
+#else
+ return std::sqrt(__x * __x + __y * __y);
+#endif
}
template<typename _UniformRandomNumberGenerator>
@@ -1054,7 +1058,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma());
result_type __x = this->_M_ndx(__px, __urng);
result_type __y = this->_M_ndy(__py, __urng);
+#if _GLIBCXX_USE_C99_MATH_TR1
return std::hypot(__x, __y);
+#else
+ return std::sqrt(__x * __x + __y * __y);
+#endif
}
template<typename _ForwardIterator,
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index 86bb67f..4151daf 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -732,7 +732,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma());
result_type __x = this->_M_ndx(__px, __urng);
result_type __y = this->_M_ndy(__py, __urng);
+#if _GLIBCXX_USE_C99_MATH_TR1
*__f++ = std::hypot(__x, __y);
+#else
+ *__f++ = std::sqrt(__x * __x + __y * __y);
+#endif
}
}