Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2001-05-17 12:13:35


I think there is a consensus, after a lot of discussion,
that by providing ample decimal digits, you stand the best
chance overall of getting the nearest value.

Mathematically, you are quite correct, but sadly the use of functions
and calculations isn't done, in real life, by any compiler(s)
as accurately as by the higher than any sensible hardware NTL software.

This is the whole reason for using external software to calculate the
constants in the first place. (If all compilers calculated constants
to 50 decimal digit accuracy we wouldn't need to worry so much).

So what you get will always be the best you can (assuming the compiler
can read decimal digiti strings OK - and they do seem to).

Paul

Dr Paul A Bristow, hetp Chromatography
Prizet Farmhouse
Kendal, Cumbria
LA8 8AB UK
+44 1539 561830
mailto:pbristow_at_[hidden]

> -----Original Message-----
> From: Corwin Joy [mailto:cjoy_at_[hidden]]
> Sent: Tuesday, May 15, 2001 6:28 AM
> To: boost_at_[hidden]
> Subject: [boost] Re: Math Constants Library formal review results
>
>
> --- In boost_at_y..., "Paul A. Bristow" <pbristow_at_h...> wrote:
> > There has been a lot of dissention about the format of my proposed
> > mathematical constants.
> > <..snip..> e.g.
> > a collection of
> > namespace math_double_constants
> > {
> > const double pi = 31459;
> > }
>
> Not to rain on your parade, but as a mathematician I can tell you
> that what you are doing here is a *bad* idea anyway. If you want to
> do serious numerical work, then I would *strongly* recommend not
> defining PI as a fixed sequence of digits like you do above because
> then you will never be able to take advantage of the full numerical
> accuracy of the machine you are working on. (Plus, it is less
> portable.) Better, is to use constants that are calculated to the
> precision of the machine you are working on e.g.
> const double pi = 4.0 *(atan(0.5) + atan(0.2) + atan(0.125));
>
> If you do something like above
> double pi = 3.15; // (rounded to 2 dp)
>
> the numerical analysts will likely be displeased.
> This kind of argument goes for many other mathematical constants that
> are transcendental or irrational.
>
> Corwin
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>


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