diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2009-05-14 08:14:54 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-05-14 08:14:54 +0000 |
commit | e1a029634255e159dc6817b24b6bcc6497fa400c (patch) | |
tree | 81c07d1408e4ec036fcb7e5575325772536a4e20 | |
parent | 4d3aadab343ac004710ff3c04686617a895e3796 (diff) | |
download | gcc-e1a029634255e159dc6817b24b6bcc6497fa400c.zip gcc-e1a029634255e159dc6817b24b6bcc6497fa400c.tar.gz gcc-e1a029634255e159dc6817b24b6bcc6497fa400c.tar.bz2 |
random.tcc (cauchy_distribution<>:: operator()(_UniformRandomNumberGenerator&, const param_type&)): Avoid M_PI, a glibc extension.
2009-05-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/random.tcc (cauchy_distribution<>::
operator()(_UniformRandomNumberGenerator&, const param_type&)):
Avoid M_PI, a glibc extension.
From-SVN: r147521
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/random.tcc | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8e854d6..eb35280 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2009-05-14 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/random.tcc (cauchy_distribution<>:: + operator()(_UniformRandomNumberGenerator&, const param_type&)): + Avoid M_PI, a glibc extension. + 2009-05-13 Ben Elliston <bje@au.ibm.com> * include/Makefile.am (PCHFLAGS): Remove -Winvalid-pch. diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 8944c11..0e917b2 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -1653,12 +1653,11 @@ namespace std __aurng(__urng); _RealType __u; do - { - __u = __aurng(); - } + __u = __aurng(); while (__u == 0.5); - return __p.a() + __p.b() * std::tan(M_PI * __u); + const _RealType __pi = 3.1415926535897932384626433832795029L; + return __p.a() + __p.b() * std::tan(__pi * __u); } template<typename _RealType, typename _CharT, typename _Traits> |