This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 400+ libstdc++ testsuite failures due to missing definition of M_PI


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>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]