Boost logo

Boost :

Subject: Re: [boost] Boost.Math and Math Constants
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-12-07 12:11:28

>> using boost::math::double_constants;
>> double area = pi * r * r;
>> and users can read the equations easily.
>> (Float and long double are similarly available in their own namespaces).
> It seems like this isn't a huge improvement over
> double const pi = boost::math::constants::pi< double >();
> double area = pi * r * r;

As a dyed in the wool C++'er I'd agree.

But a previous review of a MathConstants lib by Paul failed because folks
got very hot under the collar about this. Some folks needed constants that
could be used in generic code, others were of the "over my dead body unless
it's a constant variable in a header" persuasion. So we made both
available. So <shrug> I guess.

Hoping to avoid the flame wars this time around yours, John ;-)

Boost list run by bdawes at, gregod at, cpdaniel at, john at