Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13011: BOOST_TEST broken with floating point relational operators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-05-06 00:39:45
#13011: BOOST_TEST broken with floating point relational operators
-------------------------------+------------------------
Reporter: chris42f@⦠| Owner: rogeeff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
Version: Boost 1.63.0 | Severity: Regression
Resolution: | Keywords:
-------------------------------+------------------------
Comment (by chris42f@â¦):
Right, thanks for digging. Honestly I didn't expect floating point
comparison magic in BOOST_TEST by default, and was expecting to do my own
epsilon testing.
It's unfortunate that the default behavior fails some obvious desired
properties at 0.0 - which as the additive identity is arguably the most
commonly encountered value out of the entire floating point range.
I'll admit that in the real use case, I was trying to do my own epsilon
testing with a known absolute tolerance specific to the problem -
something like
{{{
BOOST_TEST(fabs(a-b) < 1e-16)
}}}
which fails when a happens to be equal to b. Overall, I'm not thrilled
that boost tries to completely hide the problems of floating point
comparison from users.
For this case, it sounds like a solution with the current API is to use
the obviously naive expression
{{{
BOOST_TEST(a == b)
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/13011#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-05-06 00:43:39 UTC