re PR libstdc++/62118 (cases under libstdc++-v3/testsuite/ext/ failed on aarch64/arm)
2014-08-13 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/62118 * include/ext/random.tcc (uniform_on_sphere_helper<2, _RealType>:: operator()): Use std::hypot only when _GLIBCXX_USE_C99_MATH_TR1. From-SVN: r213906
This commit is contained in:
parent
0bcb976e6a
commit
a3ee88517c
|
@ -1,3 +1,9 @@
|
||||||
|
2014-08-13 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR libstdc++/62118
|
||||||
|
* include/ext/random.tcc (uniform_on_sphere_helper<2, _RealType>::
|
||||||
|
operator()): Use std::hypot only when _GLIBCXX_USE_C99_MATH_TR1.
|
||||||
|
|
||||||
2014-08-12 Jonathan Wakely <jwakely@redhat.com>
|
2014-08-12 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
* include/bits/basic_string.h (getline): Qualify call to prevent ADL
|
* include/bits/basic_string.h (getline): Qualify call to prevent ADL
|
||||||
|
|
|
@ -1547,10 +1547,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
template<std::size_t _Dimen, typename _RealType>
|
template<std::size_t _Dimen, typename _RealType>
|
||||||
class uniform_on_sphere_helper
|
class uniform_on_sphere_helper
|
||||||
{
|
{
|
||||||
typedef typename uniform_on_sphere_distribution<_Dimen, _RealType>::result_type result_type;
|
typedef typename uniform_on_sphere_distribution<_Dimen, _RealType>::
|
||||||
|
result_type result_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename _NormalDistribution, typename _UniformRandomNumberGenerator>
|
template<typename _NormalDistribution,
|
||||||
|
typename _UniformRandomNumberGenerator>
|
||||||
result_type operator()(_NormalDistribution& __nd,
|
result_type operator()(_NormalDistribution& __nd,
|
||||||
_UniformRandomNumberGenerator& __urng)
|
_UniformRandomNumberGenerator& __urng)
|
||||||
{
|
{
|
||||||
|
@ -1604,9 +1606,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
}
|
}
|
||||||
while (__sq == _RealType(0) || __sq > _RealType(1));
|
while (__sq == _RealType(0) || __sq > _RealType(1));
|
||||||
|
|
||||||
|
#if _GLIBCXX_USE_C99_MATH_TR1
|
||||||
// Yes, we do not just use sqrt(__sq) because hypot() is more
|
// Yes, we do not just use sqrt(__sq) because hypot() is more
|
||||||
// accurate.
|
// accurate.
|
||||||
auto __norm = std::hypot(__ret[0], __ret[1]);
|
auto __norm = std::hypot(__ret[0], __ret[1]);
|
||||||
|
#else
|
||||||
|
auto __norm = std::sqrt(__ret[0] * __ret[0] + __ret[1] * __ret[1]);
|
||||||
|
#endif
|
||||||
__ret[0] /= __norm;
|
__ret[0] /= __norm;
|
||||||
__ret[1] /= __norm;
|
__ret[1] /= __norm;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue