// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // $Id: test_math_functional.cpp 46 2008-08-19 16:47:23Z maehne $ //////////////////////////////////////////////////////////////////////// /// /// \file test_math_functional.hpp /// /// \brief Unit test for checking the functors wrappers defined in /// \. /// /// \author Torsten Maehne /// \date 2008-06-06 /// /// \todo Activate test for fma, nearbyint, and rint functor wrappers, /// which depend on currently unfinished functions in /// boost::units. /// /// \todo Activate tests for nexttoward (function, which is currently /// unimplemented in Boost.Math). /// /// \bug Test round(-1.5) == -2.0 does not hold true (deactivated). /// /// \bug Test signbit(-0.0 * si::meter) != 0 does not hold true /// (deactivated). /// //////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include "test_header.hpp" namespace bl = boost::lambda; namespace bu = boost::units; namespace bmf = boost::math::functional; namespace buf = boost::units::functional; namespace si = boost::units::si; /// Calculates the absolute error |val - ref|. /// /// \param val actual value /// \param ref reference value /// /// \return absolute error |val - ref| template X absolute_error(const X& val, const Y& ref) { using namespace std; using namespace boost::units; return abs(val - ref); } int test_main(int argc, char *argv[]) { using namespace std; using namespace bmf; using namespace buf; using bu::quantity; using bu::static_rational; using bl::bind; using bl::_1; using bl::_2; using bl::_3; const double MAX_ABS_ERROR = 1.0e-12; // isfinite_t functor BOOST_CHECK(((bind(isfinite_t(), _1))(5.0) == true)); BOOST_CHECK(((bind(isfinite_t(), _1))(5.0 * si::meter) == true)); BOOST_CHECK(((bind(isfinite_t(), _1))(numeric_limits::infinity()) == false)); BOOST_CHECK(((bind(isfinite_t(), _1))(quantity::from_value(numeric_limits::infinity())) == false)); // isinf_t functor BOOST_CHECK(((bind(isinf_t(), _1))(5.0) == false)); BOOST_CHECK(((bind(isinf_t(), _1))(5.0 * si::meter) == false)); BOOST_CHECK(((bind(isinf_t(), _1))(numeric_limits::infinity()) == true)); BOOST_CHECK(((bind(isinf_t(), _1))(quantity::from_value(numeric_limits::infinity())) == true)); // isnan_t functor BOOST_CHECK(((bind(isnan_t(), _1))(5.0) == false)); BOOST_CHECK(((bind(isnan_t(), _1))(5.0 * si::meter) == false)); BOOST_CHECK(((bind(isnan_t(), _1))(numeric_limits::quiet_NaN()) == true)); BOOST_CHECK(((bind(isnan_t(), _1))(quantity::from_value(numeric_limits::quiet_NaN())) == true)); // isgreater_t functor BOOST_CHECK(((bind(isgreater_t(), _1, _2))(1.0, 2.0) == false)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(2.0, 2.0) == false)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(3.0, 2.0) == true)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(1.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(2.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == false)); BOOST_CHECK(((bind(isgreater_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == false)); // isgreaterequal_t functor BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(1.0, 2.0) == false)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(2.0, 2.0) == true)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(3.0, 2.0) == true)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(1.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(2.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == false)); BOOST_CHECK(((bind(isgreaterequal_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == false)); // isless_t functor BOOST_CHECK(((bind(isless_t(), _1, _2))(1.0, 2.0) == true)); BOOST_CHECK(((bind(isless_t(), _1, _2))(2.0, 2.0) == false)); BOOST_CHECK(((bind(isless_t(), _1, _2))(3.0, 2.0) == false)); BOOST_CHECK(((bind(isless_t(), _1, _2))(1.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(isless_t(), _1, _2))(2.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isless_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isless_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == false)); BOOST_CHECK(((bind(isless_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == false)); // islessequal_t functor BOOST_CHECK(((bind(islessequal_t(), _1, _2))(1.0, 2.0) == true)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(2.0, 2.0) == true)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(3.0, 2.0) == false)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(1.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(2.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == false)); BOOST_CHECK(((bind(islessequal_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == false)); // islessgreater_t functor BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(1.0, 2.0) == true)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(2.0, 2.0) == false)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(3.0, 2.0) == true)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(1.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(2.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == true)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == false)); BOOST_CHECK(((bind(islessgreater_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == false)); // isunordered_t functor BOOST_CHECK(((bind(isunordered_t(), _1, _2))(1.0, 2.0) == false)); BOOST_CHECK(((bind(isunordered_t(), _1, _2))(3.0 * si::meter, 2.0 * si::meter) == false)); BOOST_CHECK(((bind(isunordered_t(), _1, _2))(numeric_limits::quiet_NaN(), 2.0) == true)); BOOST_CHECK(((bind(isunordered_t(), _1, _2))(3.0 * si::meter, quantity::from_value(numeric_limits::quiet_NaN())) == true)); // abs_t functor BOOST_CHECK(((bind(abs_t(), _1))(-2.5) == 2.5)); BOOST_CHECK(((bind(abs_t(), _1))(-3.5 * si::second) == 3.5 * si::second)); // ceil_t functor BOOST_CHECK(((bind(ceil_t(), _1))(2.5) == 3.0)); BOOST_CHECK(((bind(ceil_t(), _1))(-3.2 * si::second) == -3.0 * si::second)); // copysign_t functor (currently broken) BOOST_CHECK(((bind(copysign_t(), _1, _2))(-3.3, 2.2) == 3.3)); BOOST_CHECK(((bind(copysign_t(), _1, _2))(-2.6, -2.2) == -2.6)); BOOST_CHECK(((bind(copysign_t(), _1, _2))(4.3, -1.2) == -4.3)); BOOST_CHECK(((bind(copysign_t(), _1, _2))(-3.3 * si::meter, 2.2 * si::meter) == 3.3 * si::meter)); BOOST_CHECK(((bind(copysign_t(), _1, _2))(-2.6 * si::meter, -2.2 * si::meter) == -2.6 * si::meter)); BOOST_CHECK(((bind(copysign_t(), _1, _2))(4.3 * si::meter, -1.2 * si::meter) == -4.3 * si::meter)); // fabs_t functor BOOST_CHECK(((bind(fabs_t(), _1))(-2.5) == 2.5)); BOOST_CHECK(((bind(fabs_t(), _1))(-3.5 * si::second) == 3.5 * si::second)); /// floor_t functor BOOST_CHECK(((bind(floor_t(), _1))(2.5) == 2.0)); BOOST_CHECK(((bind(floor_t(), _1))(-3.2 * si::second) == -4.0 * si::second)); /// fdim_t functor BOOST_CHECK((absolute_error((bind(fdim_t(), _1, _2))(2.5, 3.2), 0.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(fdim_t(), _1, _2))(3.2 * si::second, 2.2 * si::second), 1.0 * si::second) <= MAX_ABS_ERROR * si::second)); #if TBD // { /// fma_t functor BOOST_CHECK((absolute_error((bind(fma_t(), _1, _2, _3))(2.0, 3.0, 4.0), 10.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(fma_t(), _1, _2, _3))(-2.0 * si::meter_per_second, 3.0 * si::second, 4.0 * si::meter), -2.0 * si::meter) <= MAX_ABS_ERROR * si::meter)); #endif // } TBD /// fmax_t functor BOOST_CHECK(((bind(fmax_t(), _1, _2))(2.5, 3.2) == 3.2)); BOOST_CHECK(((bind(fmax_t(), _1, _2))(-3.2 * si::second, -2.3 * si::second) == -2.3 * si::second)); /// fmin_t functor BOOST_CHECK(((bind(fmin_t(), _1, _2))(2.5, 3.2) == 2.5)); BOOST_CHECK(((bind(fmin_t(), _1, _2))(-3.2 * si::second, -2.3 * si::second) == -3.2 * si::second)); /// fpclassify_t functor BOOST_CHECK(((bind(fpclassify_t(), _1))(numeric_limits::quiet_NaN()) == FP_NAN)); BOOST_CHECK(((bind(fpclassify_t(), _1))(quantity::from_value(numeric_limits::quiet_NaN())) == FP_NAN)); BOOST_CHECK(((bind(fpclassify_t(), _1))(numeric_limits::infinity()) == FP_INFINITE)); BOOST_CHECK(((bind(fpclassify_t(), _1))(quantity::from_value(numeric_limits::infinity())) == FP_INFINITE)); BOOST_CHECK(((bind(fpclassify_t(), _1))(0.0) == FP_ZERO)); BOOST_CHECK(((bind(fpclassify_t(), _1))(-0.0 * si::meter) == FP_ZERO)); BOOST_CHECK(((bind(fpclassify_t(), _1))(numeric_limits::denorm_min()) == FP_SUBNORMAL)); BOOST_CHECK(((bind(fpclassify_t(), _1))(quantity::from_value(numeric_limits::denorm_min())) == FP_SUBNORMAL)); BOOST_CHECK(((bind(fpclassify_t(), _1))(1.3) == FP_NORMAL)); BOOST_CHECK(((bind(fpclassify_t(), _1))(-2.4 * si::meter) == FP_NORMAL)); /// hypot_t functor BOOST_CHECK((absolute_error((bind(hypot_t(), _1, _2))(3.0, 4.0), 5.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(hypot_t(), _1, _2))(3.0 * si::meter, 4.0 * si::meter), 5.0 * si::meter) <= MAX_ABS_ERROR * si::meter)); #if TBD // { /// nearbyint_t functor BOOST_CHECK(((bind(nearbyint_t(), _1))(2.5) == 2.0)); BOOST_CHECK(((bind(nearbyint_t(), _1))(-1.5) == -2.0)); BOOST_CHECK(((bind(nearbyint_t(), _1))(-2.5 * si::second) == -2.0 * si::second)); BOOST_CHECK(((bind(nearbyint_t(), _1))(3.5 * si::second) == 4.0 * si::second)); #endif // } TBD /// nextafter_t functor BOOST_CHECK(((bind(nextafter_t(), _1, _2))(0.0, 1.0) == nextafter(0.0, 1.0))); BOOST_CHECK(((bind(nextafter_t(), _1, _2))(0.0 * si::meter, -1.0 * si::meter) == nextafter(0.0, -1.0) * si::meter)); #if TBD // { /// nexttoward_t functor BOOST_CHECK(((bind(nexttoward_t(), _1, _2))(0.0, 1.0) == nexttoward(0.0, 1.0))); BOOST_CHECK(((bind(nexttoward_t(), _1, _2))(0.0 * si::meter, -1.0 * si::meter) == nexttoward(0.0, -1.0) * si::meter)); #endif // } TBD #if TBD // { /// rint_t functor BOOST_CHECK(((bind(rint_t(), _1))(2.5) == 2.0)); BOOST_CHECK(((bind(rint_t(), _1))(-1.5) == -2.0)); BOOST_CHECK(((bind(rint_t(), _1))(-2.5 * si::second) == -2.0 * si::second)); BOOST_CHECK(((bind(rint_t(), _1))(3.5 * si::second) == 4.0 * si::second)); #endif // } TBD /// round_t functor BOOST_CHECK(((bind(round_t(), _1))(2.5) == 3.0)); #if TBD // { BOOST_CHECK((absolute_error((bind(round_t(), _1))(-1.5), -2.0) <= MAX_ABS_ERROR)); #endif // } TBD BOOST_CHECK(((bind(round_t(), _1))(-3.2 * si::second) == -3.0 * si::second)); BOOST_CHECK(((bind(round_t(), _1))(3.7 * si::second) == 4.0 * si::second)); /// signbit_t functor BOOST_CHECK(((bind(signbit_t(), _1))(0.0) == 0)); BOOST_CHECK(((bind(signbit_t(), _1))(0.0 * si::second) == 0)); #if TBD // { BOOST_CHECK(((bind(signbit_t(), _1))(-0.0) != 0)); BOOST_CHECK(((bind(signbit_t(), _1))(-0.0 * si::meter) != 0)); #endif // } TBD /// trunc_t functor BOOST_CHECK(((bind(trunc_t(), _1))(2.5) == 2.0)); BOOST_CHECK(((bind(trunc_t(), _1))(-1.5) == -1.0)); BOOST_CHECK(((bind(trunc_t(), _1))(-3.2 * si::second) == -3.0 * si::second)); BOOST_CHECK(((bind(trunc_t(), _1))(3.7 * si::second) == 3.0 * si::second)); /// fmod_t functor BOOST_CHECK((absolute_error((bind(fmod_t(), _1, _2))(32.0, 5.0), 2.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(fmod_t(), _1, _2))(63.0 * si::si_dimensionless, 25.0 * si::si_dimensionless), 13.0 * si::si_dimensionless) <= MAX_ABS_ERROR)); /// modf_t functor { double ipart = 0.0; BOOST_CHECK((absolute_error((bind(modf_t(), _1, _2))(3.125, &ipart), 0.125) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error(ipart, 3.0) <= MAX_ABS_ERROR)); } { quantity ipart = 0.0 * si::si_dimensionless; BOOST_CHECK((absolute_error((bind(modf_t(), _1, _2))(5.4 * si::si_dimensionless, &ipart), 0.4 * si::si_dimensionless) <= MAX_ABS_ERROR * si::si_dimensionless)); BOOST_CHECK((absolute_error(ipart, 5.0 * si::si_dimensionless) <= MAX_ABS_ERROR)); } /// frexp_t functor { int exp = 0; BOOST_CHECK((absolute_error((bind(frexp_t(), _1, _2))(0.0075, &exp), 0.96) <= MAX_ABS_ERROR)); BOOST_CHECK((exp == -7)); BOOST_CHECK((absolute_error((bind(frexp_t(), _1, _2))(0.0325 * si::si_dimensionless, &exp), 0.52 * si::si_dimensionless) <= MAX_ABS_ERROR * si::si_dimensionless)); BOOST_CHECK((exp == -4)); } /// pow_t functor BOOST_CHECK((absolute_error((bind(pow_t(), _1, _2))(2.0, 3.0), 8.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(pow_t(), _1, _2))(2.0 * si::si_dimensionless, 2.0 * si::si_dimensionless), 4.0 * si::si_dimensionless) <= MAX_ABS_ERROR * si::si_dimensionless)); /// static_rational_pow_t functor BOOST_CHECK((absolute_error((bind(static_rational_pow_t >(), _1))(8.0), 4.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(static_rational_pow_t >(), _1))(8.0 * si::meter * si::meter * si::meter), 4.0 * si::meter * si::meter) <= MAX_ABS_ERROR * si::meter * si::meter)); /// static_integer_pow_t functor BOOST_CHECK((absolute_error((bind(static_integer_pow_t<3>(), _1))(2.0), 8.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(static_integer_pow_t<3>(), _1))(2.0 * si::meter), 8.0 * si::meter * si::meter * si::meter) <= MAX_ABS_ERROR * si::meter * si::meter * si::meter)); /// exp_t functor BOOST_CHECK((absolute_error((bind(exp_t(), _1))(1.0), M_E) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(exp_t(), _1))(-1.0 * si::si_dimensionless), (1.0 / M_E) * si::si_dimensionless) <= MAX_ABS_ERROR)); /// ldexp_t functor BOOST_CHECK((absolute_error((bind(ldexp_t(), _1, _2))(4.0, -3), 0.5) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(ldexp_t(), _1, _2))(-3.0 * si::meter, 3), -24.0 * si::meter) <= MAX_ABS_ERROR * si::meter)); /// log_t functor BOOST_CHECK((absolute_error((bind(log_t(), _1))(M_E), 1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(log_t(), _1))(1.0 / M_E * si::si_dimensionless), -1.0 * si::si_dimensionless) <= MAX_ABS_ERROR)); /// log10_t functor BOOST_CHECK((absolute_error((bind(log10_t(), _1))(0.01), -2.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(log10_t(), _1))(1.0e7 * si::si_dimensionless), 7.0 * si::si_dimensionless) <= MAX_ABS_ERROR)); /// sqrt_t functor BOOST_CHECK((absolute_error((bind(sqrt_t(), _1))(4.0), 2.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(sqrt_t(), _1))(4.0 * si::meter * si::meter), 2.0 * si::meter) <= MAX_ABS_ERROR * si::meter)); /// static_rational_root_t functor BOOST_CHECK((absolute_error((bind(static_rational_root_t >(), _1))(8.0), 4.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(static_rational_root_t >(), _1))(8.0 * si::meter * si::meter * si::meter), 4.0 * si::meter * si::meter) <= MAX_ABS_ERROR * si::meter * si::meter)); /// static_integer_root_t functor BOOST_CHECK((absolute_error((bind(static_integer_root_t<3>(), _1))(8.0), 2.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(static_integer_root_t<3>(), _1))(8.0 * si::meter * si::meter * si::meter), 2.0 * si::meter) <= MAX_ABS_ERROR * si::meter)); // cos_t functor BOOST_CHECK((absolute_error((bind(cos_t(), _1))(M_PI), -1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(cos_t(), _1))(0.5 * M_PI * si::radian), 0.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((1.5 * si::volt * bind(cos_t(), 2.0 * M_PI * si::radian * 50.0 * si::hertz * _1))(10.0e-3 * si::second), -1.5 * si::volt) <= MAX_ABS_ERROR * si::volt)); // sin_t functor BOOST_CHECK((absolute_error((bind(sin_t(), _1))(0.5 * M_PI), 1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(sin_t(), _1))(0.5 * M_PI * si::radian), 1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((1.5 * si::volt * bind(sin_t(), 2.0 * M_PI * si::radian * 50.0 * si::hertz * _1))(5.0e-3 * si::second), 1.5 * si::volt) <= MAX_ABS_ERROR * si::volt)); // tan_t functor BOOST_CHECK((absolute_error((bind(tan_t(), _1))(0.25 * M_PI), 1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(tan_t(), _1))(0.25 * M_PI * si::radian), 1.0) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((1.5 * si::volt * bind(tan_t(), 2.0 * M_PI * si::radian * 50.0 * si::hertz * _1))(2.5e-3 * si::second), 1.5 * si::volt) <= MAX_ABS_ERROR * si::volt)); // acos_t functor BOOST_CHECK((absolute_error((bind(acos_t(), _1))(-1.0), M_PI) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(acos_t(), _1))(0.0 * si::si_dimensionless), 0.5 * M_PI * si::radian) <= MAX_ABS_ERROR * si::radian)); // asin_t functor BOOST_CHECK((absolute_error((bind(asin_t(), _1))(-1.0), -0.5 * M_PI) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(asin_t(), _1))(0.5 * si::si_dimensionless), (M_PI / 6.0) * si::radian) <= MAX_ABS_ERROR * si::radian)); // atan_t functor BOOST_CHECK((absolute_error((bind(atan_t(), _1))(1.0), 0.25 * M_PI) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(atan_t(), _1))((sqrt(3)/3.0) * si::si_dimensionless), (M_PI / 6.0) * si::radian) <= MAX_ABS_ERROR * si::radian)); // atan2_t functor BOOST_CHECK((absolute_error((bind(atan2_t(), _1, _2))(-1.0, -1.0), -0.75 * M_PI) <= MAX_ABS_ERROR)); BOOST_CHECK((absolute_error((bind(atan2_t(), _1, _2))(-sqrt(3) * si::si_dimensionless, 3.0 * si::si_dimensionless), -(M_PI / 6.0) * si::radian) <= MAX_ABS_ERROR * si::radian)); return 0; }