Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-09-29 11:14:16


>>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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net