This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: 400+ libstdc++ testsuite failures due to missing definition of M_PI
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: David Billinghurst <dbcygwin at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 14 May 2009 10:18:02 +0200
- Subject: Re: 400+ libstdc++ testsuite failures due to missing definition of M_PI
- References: <4A0BA8DB.5030709@gmail.com>
David Billinghurst wrote:
> This is not unreasonable, as the C++0X standard (from ISO/IEC JTC 1/SC
> 22 N 4411 2008-10-09) doesn't mention M_PI (in <cmath> or elsewhere).
You are right, M_PI is an extension. I committed the below for now, at
least.
Paolo.
////////////////
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.
Index: include/bits/random.tcc
===================================================================
--- include/bits/random.tcc (revision 147519)
+++ include/bits/random.tcc (working copy)
@@ -1653,12 +1653,11 @@
__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>