[Math] Best Way to Produce Pi
Dear all, What's my best way to define a constant for Pi. I'm thinking of using the following <cmath> stuff: const double pi(4 * atan(1)); Does Boost provide a better solution? TIA, --Hossein
On 2010-10-08 13:19, Hossein Haeri wrote:
Dear all,
What's my best way to define a constant for Pi. I'm thinking of using the following<cmath> stuff:
const double pi(4 * atan(1));
Does Boost provide a better solution?
TIA, --Hossein
Stuff like this? http://www.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/math_too... Cheers, Rutger
At Fri, 08 Oct 2010 13:28:35 +0200, Rutger ter Borg wrote:
Stuff like this?
http://www.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/math_too...
And if you really need precision (you have a high-precision number class), you might look at http://www.cygnus-software.com/misc/pidigits.htm -- Dave Abrahams BoostPro Computing http://www.boostpro.com
Cool! Thanks Dave and Rutger. :)
--- On Fri, 8/10/10, David Abrahams
From: David Abrahams
Subject: Re: [Boost-users] [Math] Best Way to Produce Pi To: boost-users@lists.boost.org Date: Friday, 8 October, 2010, 12:42 At Fri, 08 Oct 2010 13:28:35 +0200, Rutger ter Borg wrote: Stuff like this?
http://www.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/math_too...
And if you really need precision (you have a high-precision number class), you might look at http://www.cygnus-software.com/misc/pidigits.htm
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Hossein Haeri Sent: Friday, October 08, 2010 1:20 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Math] Best Way to Produce Pi
Cool! Thanks Dave and Rutger. :)
--- On Fri, 8/10/10, David Abrahams
wrote: From: David Abrahams
Subject: Re: [Boost-users] [Math] Best Way to Produce Pi To: boost-users@lists.boost.org Date: Friday, 8 October, 2010, 12:42 At Fri, 08 Oct 2010 13:28:35 +0200, Rutger ter Borg wrote: Stuff like this?
http://www.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/ math_toolkit/toolkit/internals1/constants.html
I have already added a few more constants like this that are used internally by Boost.Math , but I'm open to suggestions for others. We aim for at least 50 decimal digits accuracy (often 100), but of course you only get the maximum precision of your type, usually double. There still are many 40 decimal digits constants in the vault http://www.boostpro.com/vault/ Math_constants3.zip All of these are still constant ;-) Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com
participants (4)
-
David Abrahams
-
Hossein Haeri
-
Paul A. Bristow
-
Rutger ter Borg