Boost logo

Boost :

From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2007-05-15 11:51:12


OK, here is an opportunity to get me clear on comparing floating point
values. I've found a very simple example, that I can not get to work --
and understand...

Say I have a class that saves and restores a class. In the class, I
have a double, a float, and a long double. As a test, I set the
"floating" values to std::numeric_limits< T >::min() and
std::numeric_limits< T >::max(), and then save the values, restore them,
and compare the restored values to the originals.

Obviously, I can not use BOOST_CHECK_EQUAL(), but I am clueless as to
how to use the macros for comparing floating point values. Is there
anything in numeric_limits that I should use to base the percentage
value?

Here's a chance for someone to finally clear my understanding of how to
compare floating point value... please ?!?!?

Thanks!


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