|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-05-17 14:09:10
"Paul A Bristow" <pbristow_at_[hidden]> wrote in message
news:001601c7979f$b5c37bb0$0200a8c0_at_hetp7...
>>> Why do you expect two infinity values to be close with any tolerance?
>>
>>Interesting question: if the too values are the same, then I
>>would have
>>expected BOOST_CHECK_CLOSE to pass. But then we get into
>>philisophical
>>discussions about whether two infinities are really the same :-)
>
> Well we certainly don't want any philosophical discussions :-))
>
> In BOOST_CHECK we are really comparing two bit patterns - both of which
> are std::numeric_limits<T>::infinity() and will presumably
This is not exactly true in general. BOOST_CHECK uses operator==.
BOOST_CHECK_CLOSE doesn't compare bit patterns either. It uses some advanced
algorithm. So we may decide what is the desirable outcome.
> pass a BOOST_CHECK_EQUAL test, so I also would expect a BOOST_CHECK_CLOSE
> pass, whatever the tolerance.
>
> But most important is to try to agree and to document our conclusion?
Getting back to our FP we need to decide
Does
0. == 0.
NaN == NaN
Inf == Inf.
My guess is that curent algorithm produces false in all three cases.
My vote would be to keep it this way.
Gennadiy
> Paul
>
> ---
> Paul A Bristow
> Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
> +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS
> pbristow_at_[hidden]
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk