Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2004-01-22 08:56:33

Some rather accurate constants that I proposed some years ago are attached.

(These are almost accurate enough for all conceivable processors using 128 bits
for floating point calculations. I plan to use 40 decimal digits for a release

The Politically Correct C++ers felt that there was no place for C macros in a
Boost C++ library, but we have still not found a portable way of presenting
these values in true C++ form allowing pi (etc) to be written as pi rather than

There was widespread agreement that no solution requiring pi() would be widely

My personal view was that the namespace solution produced by Michael Kenniston
was OK, but several recent reviewers had a violent objection to it.

It remains my view that until an 'ideal' solution can be found, we should make
the constants available as C macros, for example:


Although many of these values are fairly easily found using internet searches,
it is undoubtedly a convenience to have them all in one file.


PS To Daniel Frey - typeof is fine by me - provided versions can be provided for
all the recent main compilers. (For the obselete compilers we could just provide
the C Macro values).

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of Andy Little
| Sent: Wednesday, January 21, 2004 9:17 AM
| To: boost_at_[hidden]
| Subject: [boost] Re: math_constants parameterisation and return by ref
| "Andy Little" <andy_at_[hidden]> wrote
| > BTW having used the constants , the fact that they are so accurate gives
| me
| > a warm glow :-)
| Any chance of some degrees <--> radians etc constants/functions too?
| In fact Hows about:
| boost::math::angle::rad alpha(.5);
| boost::math::angle::deg beta = alpha;

The constants needed are:

        /* degree and radian. */
#define BOOST_DEGREE 0.0174532925199432957692369076848861271L /* radians =
pi/180 */
#define BOOST_RADIAN 57.2957795130823208767981548141051703L /* degrees = 180/pi

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