|
Boost : |
From: Paul A. Bristow (boost_at_[hidden])
Date: 2002-07-11 04:22:36
I'd prefer to turn that upside down.
The proposed constants are as accurate as can be represented
for all foreseeable Floating point formats
(40 decimal digits, more than enough for 128 bit Floating point).
The compiler is reposible for converting the decimal digits
into the best representation possible for the floating point format
in use (float, double ...)
It is up to the sin and cos (and other trig functions) to try to provide a
result which is as good (that is within one least significant bit (ULP)).
Using the accurate value may lead to backward incompatibility,
(in which case don't do it perhaps)
but is an investment for lack of trouble in the future.
Paul
PS there are of course dozens of other constants.
Pi is only a simple example - a prototype for others.
Dr Paul A Bristow, hetp Chromatography
Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
mailto:pbristow_at_[hidden]
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]On Behalf Of Alex Rosenberg
> Sent: Wednesday, July 10, 2002 10:24 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Math Constants revisited
>
>
> on 7/7/02 11:18 PM, Paul A. Bristow at boost_at_[hidden] wrote:
>
> > Some time ago I started what became a long discussion about the
> presentation
> > of math constants, like pi.
>
> It would be best to offer up a constant for pi that "matches" the one used
> in the provided transcendental functions (sin, cos, etc.)
>
> At least, that was the rational behind the presence of "extern
> double_t pi"
> in Apple's fp.h header. It is then imported from the same
> dynamically-linked
> library that provides the transcendentals.
>
> I'm told that this was the cause of some of the more popular result
> discrepancies that happened with Motorola's "libmoto" library
> that purported
> to speed up these functions.
>
> +------------------------------------------------------------+
> | Alexander M. Rosenberg <mailto:alexr@_spies.com> |
> | Nobody cares what I say. Remove the underscore to mail me. |
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk