
Boost : 
Subject: [boost] Boost.Math and Math Constants
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 20111207 10:33:21
Boost.Math has always had an inconspicuous collection of useful math constants, mainly those that
are used internally.
The presentation of these was as a functiontemplate, called for example, as pi<double>().
using namespace boost::math::constants;
return pi<Real>() * r * r;
This leads to some rather ugly equations and is most unpopular with scientific and engineering
users.
John Maddock has now added a new cunning feature that allows the vast majority of users who just
want a builtin double to get the constants quickly as plain variables. So in nontemplate code,
users can write
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).
The original mechanism which can be used for higher multiprecision userdefined floatingpoint types
appears unchanged but has been improved to work better with UDTs and high precision types.
Some draft detailed docs about just these new proposals are at
http://boostsandbox.sourceforge.net/libs/math_constants/doc/html/index.html
We would like to be sure that
1 This additional mechanism of presenting constants is acceptable.
2 It is acceptable to add more constants (current new list is about 60 constants).
Are there important constants that you think we have missed?
Do we need a minireview?
Other views?
Paul
PS
1 Are there important constants that you think we have missed?
2 Please tell me of mistakes and typos in the draft docs.
 Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk