Boost logo

Boost Users :

From: Hubert Holin (yg-boost-users_at_[hidden])
Date: 2003-03-24 09:26:23


Somewhere in the E.U., le 24/03/2003

    Bonjour

In article <b5kso9+6mqp_at_[hidden]>,
 "adam_speight" <adam_speight_at_[hidden]> wrote:

> I've often heard that you should never trust your system
> implementation of functions like sqrt, exp, sin, cos, rand, etc.
> Instead, most mathematicians say that one should use an
> implementation that is known to be accurate up to some order.
> Unfortunately, using third-party code for these functions hinders
> portability.
>
> I know that boost has a formidable random number generation library
> that uses the cmath versions of basic math functions. Does the stl
> standard, or various implementations of stl, make any gaurantees
> about the accuracy of these basic math functions? Are they safe to
> use for mathematical applications in practice?
>
> Thanks,
>
> Adam

        The C++ standard imposes no additional garanties upon the
standard math function beyong what the C standard required at the time
C++ was standardized (this is "by inclusion").

        In other words, there are scarcely any garanties at all...

        I have not looked closely at the random generators in Boost, so
I can't comment on these, but for the additional special functions in
Boost I had a hand in, the emphasis was on exactitude rather than speed.
The methods by wich their coding is derived are detailed in the doc, so
you can make your own mind about their usefullness to you. They do fall
back on system-supplied special functions outside of domains where
precisions is known to be a strong requirement.

        There is, I believe, a proposal for a few additional special
functions, notably to re-sync with the C standard.

        Note that precision is not always was people want: sometimes a
(very) quick (and notoriously dirty) approximation is enough for what
peaple want (say a game, perhaps).

        This should be improved, but will only be if people step forward
with proposals (I should know, I completely dropped the ball on a
proposal I had hoped to make relating to quaternions... :-< ).

    Bon courage

            Hubert Holin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net