
7 Dec
2011
7 Dec
'11
5:11 p.m.
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 ;-)