Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75724 - in sandbox/math_constants: boost/math/constants libs/math/test
From: john_at_[hidden]
Date: 2011-11-29 08:12:05


Author: johnmaddock
Date: 2011-11-29 08:12:05 EST (Tue, 29 Nov 2011)
New Revision: 75724
URL: http://svn.boost.org/trac/boost/changeset/75724

Log:
Fix test case, and reinstate half as a constant.
Text files modified:
   sandbox/math_constants/boost/math/constants/constants.hpp | 1 +
   sandbox/math_constants/libs/math/test/test_constants.cpp | 4 +---
   2 files changed, 2 insertions(+), 3 deletions(-)

Modified: sandbox/math_constants/boost/math/constants/constants.hpp
==============================================================================
--- sandbox/math_constants/boost/math/constants/constants.hpp (original)
+++ sandbox/math_constants/boost/math/constants/constants.hpp 2011-11-29 08:12:05 EST (Tue, 29 Nov 2011)
@@ -226,6 +226,7 @@
 BOOST_DEFINE_MATH_CONSTANT(four_minus_pi, 8.584073464102067615373566167204971158, 0283060062489417902505540769218359371379100137196517465788293201785191349, -1);
 BOOST_DEFINE_MATH_CONSTANT(pow23_four_minus_pi, 7.953167673715975443483953350568065807, 2763917332771320544530223438885626826751818759075800688860082843683980018, -1);
 BOOST_DEFINE_MATH_CONSTANT(exp_minus_half, 6.065306597126334236037995349911804534, 4191813548718695568289215873505651941374842399864761150798945602642378979, -1);
+BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000, 0000, -1);
 
 } // namespace constants
 } // namespace math

Modified: sandbox/math_constants/libs/math/test/test_constants.cpp
==============================================================================
--- sandbox/math_constants/libs/math/test/test_constants.cpp (original)
+++ sandbox/math_constants/libs/math/test/test_constants.cpp 2011-11-29 08:12:05 EST (Tue, 29 Nov 2011)
@@ -96,21 +96,19 @@
    BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(pow((4 - 3.14159265358979323846264338327950288419716939937510), 1.5)), pow23_four_minus_pi<RealType>(), tolerance);
    BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(exp(-0.5)), exp_minus_half<RealType>(), tolerance);
 #endif
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.57721566490153286060651209008240243104259335L), euler<RealType>(), tolerance);
 
    //
    // Last of all come the test cases that behave differently if we're calculating the constants on the fly:
    //
    if(boost::math::tools::digits<RealType>() > boost::math::constants::max_string_digits)
    {
- // We have no implementation for eulers constant / takes too long to calculate.
- BOOST_CHECK_THROW(euler<RealType>(), std::runtime_error);
       // This suffers from cancelation error:
       BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(4. - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi<RealType>(), tolerance * 3);
       BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three<RealType>(), tolerance * 3);
    }
    else
    {
- BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.57721566490153286060651209008240243104259335L), euler<RealType>(), tolerance);
       BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(4. - 3.14159265358979323846264338327950288419716939937510L), four_minus_pi<RealType>(), tolerance);
       BOOST_CHECK_CLOSE_FRACTION(static_cast<RealType>(0.14159265358979323846264338327950288419716939937510L), pi_minus_three<RealType>(), tolerance);
    }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk