Boost logo

Boost :

Subject: Re: [boost] Boost.Math and Math Constants
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2011-12-07 11:22:56


2011/12/7 Paul A. Bristow <pbristow_at_[hidden]>

> 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 function-template, 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 built-in double to get the constants quickly as plain variables. So
> in non-template 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).
>

I like this ;-)

>
> The original mechanism which can be used for higher multiprecision
> user-defined floating-point 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://boost-sandbox.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 mini-review?
>
> Other views?
>
> Paul
>
> PS
>
> 1 Are there important constants that you think we have missed?
>

I'm not sure if these are important constants, but if there are:
root_three, half_root_two, one_div_root_two, then I'd add: half_root_three,
and one_dif_root_three.

>
> 2 Please tell me of mistakes and typos in the draft docs.

Regards
Kris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk