> > This is what BOOST_CHECK_CLOSE is doing basically. > > > Yes, that's the point. > What I proposed is that the user can combine the macro with > the comparator (I changed the macro name), because the > comparison method is often application specific. I suggested > to have an absolute error comparator class as a default, but > not as a fixed method inside the macro. The problem with any > fixed scheme is that it can't be general enough, and the test > library is highly general. > I'm not sure if any fixed comparison method should be > supplied at all. I would choose between my proposal, were > specific targets can supply their own comparators, or not > having fp comparison at all in the test library itself.
I believe Boost.Test need to provide at least some way to check that calculated fP value is as expected. I couldn't use BOOST_EQUAL and do not want to write predicate every time I need to validate floats. I won't be generic enough to cover all the cases. But in majority of the cases it should work. In all other cases you could use BOOST_CHECK_PREDICATE with custom algorithm. It also will show mismatched values (at least try to). > >For majority of simple cases (not very big, nor very small > values) they > >should behave similarly. For edge cases relative error comparison > >produces better results IMO > > No. It is not a matter of value magnitude or edge/non-edge > cases. It is a matter of the number and type of operations > performed yielding the values to be compared. This is why the > best method is highly domain specific. Tolerance is indeed highly domain specific. And I do not force you with how to choose one. As for what is better fit in more cases absolute vs. relative comparison, I believe it's second. Could you show me an example when relative error comparison isn't correct while absolute is? While there many example of reverse situation. Most of the references I have on FP values comparison recommends to use relative errors either. > Fernando Cacciola Gennadiy. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost