Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62093 - in branches/release: boost/math boost/math/special_functions libs/math libs/math/doc/sf_and_dist libs/math/test
From: dgregor_at_[hidden]
Date: 2010-05-18 21:21:45


Author: dgregor
Date: 2010-05-18 21:21:43 EDT (Tue, 18 May 2010)
New Revision: 62093
URL: http://svn.boost.org/trac/boost/changeset/62093

Log:
Merge r62087 (a fix to cbrt's internal promotion rules) from trunk.

Properties modified:
   branches/release/boost/math/ (props changed)
   branches/release/boost/math/special_functions/ (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/math/doc/sf_and_dist/ (props changed)
   branches/release/libs/math/test/ (props changed)
Text files modified:
   branches/release/boost/math/special_functions/cbrt.hpp | 3 +
   branches/release/libs/math/test/test_cbrt.cpp | 43 +++++++++++++++++++++++++--------------
   2 files changed, 29 insertions(+), 17 deletions(-)

Modified: branches/release/boost/math/special_functions/cbrt.hpp
==============================================================================
--- branches/release/boost/math/special_functions/cbrt.hpp (original)
+++ branches/release/boost/math/special_functions/cbrt.hpp 2010-05-18 21:21:43 EDT (Tue, 18 May 2010)
@@ -153,7 +153,8 @@
 inline typename tools::promote_args<T>::type cbrt(T z, const Policy& pol)
 {
    typedef typename tools::promote_args<T>::type result_type;
- return detail::cbrt_imp(result_type(z), pol);
+ typedef typename policies::evaluation<result_type, Policy>::type value_type;
+ return static_cast<result_type>(detail::cbrt_imp(value_type(z), pol));
 }
 
 template <class T>

Modified: branches/release/libs/math/test/test_cbrt.cpp
==============================================================================
--- branches/release/libs/math/test/test_cbrt.cpp (original)
+++ branches/release/libs/math/test/test_cbrt.cpp 2010-05-18 21:21:43 EDT (Tue, 18 May 2010)
@@ -43,28 +43,39 @@
    // Define the max and mean errors expected for
    // various compilers and platforms.
    //
-
- //
- // Finish off by printing out the compiler/stdlib/platform names,
- // we do this to make it easier to mark up expected error rates.
- //
- std::cout << "Tests run with " << BOOST_COMPILER << ", "
- << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
-
+ const char* largest_type;
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
+ if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
+ {
+ largest_type = "(long\\s+)?double|real_concept";
+ }
+ else
+ {
+ largest_type = "long double|real_concept";
+ }
+#else
+ largest_type = "(long\\s+)?double|real_concept";
+#endif
    add_expected_result(
- "Borland.*", // compiler
- ".*", // stdlib
- ".*", // platform
+ "Borland.*", // compiler
+ ".*", // stdlib
+ ".*", // platform
       "long double", // test type(s)
- ".*", // test data group
- ".*", 10, 6); // test function
+ ".*", // test data group
+ ".*", 10, 6); // test function
    add_expected_result(
       ".*", // compiler
       ".*", // stdlib
       ".*", // platform
- "(long )?double|real_concept", // test type(s)
- ".*", // test data group
- ".*", 2, 2); // test function
+ largest_type, // test type(s)
+ ".*", // test data group
+ ".*", 2, 2); // test function
+ //
+ // Finish off by printing out the compiler/stdlib/platform names,
+ // we do this to make it easier to mark up expected error rates.
+ //
+ std::cout << "Tests run with " << BOOST_COMPILER << ", "
+ << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
 }
 
 struct negative_cbrt


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