|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-07-07 15:05:05
At 02:22 PM 7/7/2003, Rozental, Gennadiy wrote:
>I could probably prohibit usage of CHECK_CLOSE with number of rounding
>errors provided.
>Is there any other general recommendations how to choose the tolerance to
>FP computation correctness checking?
There has been some recent discussion on comp.lang.c++.moderated, subject
"equality of two doubles". The last post was from Andrei Alexandrescu:
>What's most of the time needed is relative precision.
>
>So, numerical gurus: how can one express "a equals b within 0.1%" over
>the whole range of floating point numbers? If that can be done, it would
>be a nice useful routine.
>
>bool approximately_equal(double lhs, double rhs, double relative_prec)
>{
> // fill in here please :o)
>}
But it really doesn't seem that a test library is the right home for such
functions. I think all the fp stuff should be removed from Boost.Test, and
passed on as a challenge to the numerics experts.
After all, the user can always write:
BOOST_CHECK( approximately_equal(...) );
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk