2 #include <boost/test/unit_test.hpp>
3 #include <boost/test/floating_point_comparison.hpp>
7 #include "utilities/fast_approximations.hpp"
16 void run_fast_atan2_tests(void)
18 for (F y
= -4; y
< 4; y
+=0.01)
19 for (F x
= -4; x
< 4; x
+=0.01)
24 F accurate
= atan2(y
, x
);
25 F fast
= fast_atan2(y
, x
);
26 F faster
= faster_atan2(y
, x
);
28 BOOST_CHECK_SMALL( accurate
- fast
, F(0.011) );
29 BOOST_CHECK_SMALL( accurate
- faster
, F(0.072) );
35 BOOST_AUTO_TEST_CASE( atan2_tests_float
)
37 run_fast_atan2_tests
<float>();
40 BOOST_AUTO_TEST_CASE( atan2_tests_double
)
42 run_fast_atan2_tests
<double>();