
On Thursday 10 November 2005 18:33, Gennadiy Rozental wrote:
"John Maddock" <john@johnmaddock.co.uk> wrote in message news:005301c5e616$7a3cef90$5c410352@fuji...
I have a couple of feature requests for Boost.Test:
1) Can BOOST_CHECK_CLOSE please print the actual difference between the values (as a percent to match the tolerance) as well as the values themselves? The reason this is important, is that it's not always easy to get this value from the input values - because the precision of the machine on which the test is run far outstrips that of the author's machine, so his calculator isn't any use :-(
This is doable. The message would sould like this:
difference between var1 {<value>} and var2 {<value>} is x% and exceeds e%
Why are we using percentage and not and not the epsilon value? Percentage just causes you to have to move the point 2 digits in your head.
2) Can we please have a that uses a whole number of epsilon as the tolerance? IMO BOOST_CHECK_CLOSE should have been written this way to begin with, but it's too late now
Actually it was this way originally. It was causing constant confusion with absolute comparison. I thought persents will bring better message. Unfortunately many users since then indicated that original version (for those who knew how to use it) was better. If there is a general consensus I am willing to rollback. Or we could introduce a new tool.
I see, I also read the docs on this. Maybe using percent give unitroduced users a better hint that it is the difference between the two values as a percentage of their distance to zero that is tested -- not a maximum value for the absolute difference between the two. I guess this is because it is hard to understand how to express an absolute value as a percentage. Hence, you kind of force them to study what to put in as parameter, make them read the documentation. If you just throw "the value of epsilon" at them, they may be more likely to be confused. I support having BOOST_CHECK_EPSILON as suggested as an alternative, its name suggest a clear meaning to those that have studied the concepts described in http://www.boost.org/libs/test/doc/components/test_tools/floating_point_comp... maybe a better name would be BOOST_CHECK_CLOSE_EPSILON as it suggest the strong relationship to BOOST_CHECK_CLOSE. After all their functionallity is the same, just different expectations on one parameter.
Again it should print out the actual relative error as a multiple of epsilon as well as the input values.
agree I also read the docs, and spotted some problems: copy/paste error in top of libs/test/doc/components/test_tools/reference/BOOST_CHECK_SMALL.html I suspect: BOOST_WARN_SMALL( val, tolerance ) BOOST_CHECK_CLOSE( val, tolerance ) BOOST_REQUIRE_CLOSE( val, tolerance ) should have been: BOOST_WARN_SMALL( val, tolerance ) BOOST_CHECK_SMALL( val, tolerance ) BOOST_REQUIRE_SMALL( val, tolerance ) and file:///dsk1/src/boost_1_33_0/libs/test/doc/components/test_tools/floating_point_comparison.html unreasonable to use an operator=(...) f ^^^^^ should be operator equal not asignment below that in same file I read: (firefox) u - v | <= e * |u| and | u - v | <= e * |v| ^^^ missing | caused by: <P style="text-indent: -20"> |<I> u </I>-<I> v </I>| <= <I>e * |u|</I> and ^^^^^^^^^^^^^^ in the html souce. regards, Bjørn Roald