
24 Dec
2008
24 Dec
'08
9:49 a.m.
Gennadiy Rozental wrote:
Hi,
I've checked in 2 changes to the floating point comparison tools.
1. BOOST_CHECK_CLOSE now can compare values of different types:
BOOST_CHECK_CLOSE( 2, 2.1, 6 ); // compare and and double BOOST_CHECK_CLOSE( 2.1, 2, 6 ); // compare double and int BOOST_CHECK_CLOSE( 2.1, 2.f, 6 ); // compare double and float
2. Floating point comparison tools now report difference if any:
BOOST_CHECK_CLOSE( 2, 2.1, 3 ) will lead to:
difference{4.7619%} between 2{2} and 2.1{2.1} exceeds 3%
BOOST_CHECK_CLOSE_FRACTION( 2, 2.1, 0.04 ) will lead to:
difference{0.047619} between 2{2} and 2.1{2.1} exceeds 0.04
Any comments appreciated,
Yeh! Thanks Gennadiy, that'll be a big help, John.