Open Kojoley opened 3 years ago
#include <boost/core/lightweight_test.hpp>
#include <limits>
int main()
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM.precision(std::numeric_limits<double>::max_digits10);
BOOST_TEST_EQ(0x9.d495182a99318p-13, 0x9.d495182a99308p-13);
return boost::report_errors();
}
prog.cc(7): test '0x9.d495182a99318p-13 == 0x9.d495182a99308p-13' ('0.0012000000000000003' == '0.0011999999999999999') failed in function 'int main()'
It probably makes sense to set the precision before printing floating point, but we need to restore it afterwards, and digits10 is C++11, so it's a bit of a hassle. Although maybe not so much.
Ah wait, it's not C++11. :-)