7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE
11 #include <boost/test/unit_test.hpp>
18 using namespace boost;
38 aInt = 0x80000000 - aInt;
42 bInt = 0x80000000 - bInt;
43 lint intDiff = (aInt >= bInt) ? (aInt - bInt) : (bInt - aInt);
47 if (intDiff <= maxUlps)
53 BOOST_AUTO_TEST_SUITE( math_checks_test_suite )
62 std::cout.setf(ios::scientific,ios::floatfield);
63 std::cout.precision(24);
68 std::cout <<
"a [" << a <<
"] & [" << *(
boost::uint64_t*)&a <<
"]" << std::endl;
69 std::cout <<
"b [" << b <<
"] & [" << *(
boost::uint64_t*)&b <<
"]" << std::endl;
74 std::cout <<
"FP says a and b are equals" << std::endl;
76 std::cout <<
"FP says a and b are different" << std::endl;
79 std::cout <<
"C2 says a and b are equals" << std::endl;
81 std::cout <<
"C2 says a and b are different" << std::endl;
85 std::cout <<
"-----------------------------------" << std::endl;
91 std::cout.setf(ios::scientific,ios::floatfield);
92 std::cout.precision(24);
98 const Real
b = *(Real*)&bi;
100 std::cout <<
"a [" << a <<
"] & [" << *(
boost::uint64_t*)&a <<
"]" << std::endl;
101 std::cout <<
"b [" << b <<
"] & [" << *(
boost::uint64_t*)&b <<
"]" << std::endl;
106 std::cout <<
"FP says a and b are equals" << std::endl;
108 std::cout <<
"FP says a and b are different" << std::endl;
111 std::cout <<
"C2 says a and b are equals" << std::endl;
113 std::cout <<
"C2 says a and b are different" << std::endl;
117 std::cout <<
"-----------------------------------" << std::endl;
123 std::cout.setf(ios::scientific,ios::floatfield);
124 std::cout.precision(24);
129 const lint bi = ai+1;
136 std::cout <<
"a [" << a <<
"] & [" << *(
boost::uint64_t*)&a <<
"]" << std::endl;
137 std::cout <<
"b [" << b <<
"] & [" << *(
boost::uint64_t*)&b <<
"]" << std::endl;
142 std::cout <<
"FP says a and b are equals" << std::endl;
144 std::cout <<
"FP says a and b are different" << std::endl;
147 std::cout <<
"C2 says a and b are equals" << std::endl;
149 std::cout <<
"C2 says a and b are different" << std::endl;
153 std::cout <<
"-----------------------------------" << std::endl;
159 BOOST_AUTO_TEST_SUITE_END()
external boost library namespace
Basic Classes for Mathematical applications used by COOLFluiD.
bool almost_equals(const FloatingPoint &rhs, const size_t ulps) const
unsigned __int64 uint64_t
Top-level namespace for coolfluid.
BOOST_AUTO_TEST_CASE(floating_point_far_from_zero)
Real real_min()
Definition of the minimum number representable with the chosen precision.
Most basic kernel library.
bool AlmostEqual2sComplement(double A, double B, boost::uint64_t maxUlps)