29 Sep
2005
29 Sep
'05
4:14 p.m.
I chose to divide percent tolerance by 100 (multiplication would lead to overflow issues). BOOST_CHECK_CLOSE doesn't really fit for integral type closeness check. You could use BOOST_CHECK_SMALL instead.
Would it not be useful to provide a specialisation of the comparison template for integral types? The current semantics aren't useful IMHO - they just give undocumented false test passes - so even a naive implementation which risked overflow would be an improvement.
But we can actually prevent overflow - just check if |a-b| is >= the maximum value for the integer type / 100, if not use 100*|a-b|/a, if so use something like |a-b|/(a/100).
I will consider this next release. Gennadiy