Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-08-19 12:37:59


Author: johnmaddock
Date: 2007-08-19 12:37:56 EDT (Sun, 19 Aug 2007)
New Revision: 38762
URL: http://svn.boost.org/trac/boost/changeset/38762

Log:
Fixed some GCC-4.2 warnings in unchecked_factorial.hpp.
Fixed some Intel-10 compile errors in error_handling.hpp.
Updated performance/main.cpp to print configuration info.
Text files modified:
   sandbox/math_toolkit/boost/math/policy/error_handling.hpp | 6 ++--
   sandbox/math_toolkit/boost/math/special_functions/detail/unchecked_factorial.hpp | 12 +++++-----
   sandbox/math_toolkit/libs/math/performance/main.cpp | 42 ++++++++++++++++++++++++++++++---------
   3 files changed, 41 insertions(+), 19 deletions(-)

Modified: sandbox/math_toolkit/boost/math/policy/error_handling.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/policy/error_handling.hpp (original)
+++ sandbox/math_toolkit/boost/math/policy/error_handling.hpp 2007-08-19 12:37:56 EDT (Sun, 19 Aug 2007)
@@ -430,7 +430,7 @@
    using namespace std;
    if(fabs(val) > tools::max_value<R>())
    {
- *result = static_cast<R>(raise_overflow_error<R>(function, 0, pol));
+ *result = static_cast<R>(boost::math::policies::detail::raise_overflow_error<R>(function, 0, pol));
       return true;
    }
    return false;
@@ -440,7 +440,7 @@
 {
    if((val != 0) && (static_cast<R>(val) == 0))
    {
- *result = static_cast<R>(raise_underflow_error<R>(function, 0, pol));
+ *result = static_cast<R>(boost::math::policies::detail::raise_underflow_error<R>(function, 0, pol));
       return true;
    }
    return false;
@@ -451,7 +451,7 @@
    using namespace std;
    if((fabs(val) < static_cast<T>(tools::min_value<R>())) && (static_cast<R>(val) != 0))
    {
- *result = static_cast<R>(raise_denorm_error<R>(function, 0, static_cast<R>(val), pol));
+ *result = static_cast<R>(boost::math::policies::detail::raise_denorm_error<R>(function, 0, static_cast<R>(val), pol));
       return true;
    }
    return false;

Modified: sandbox/math_toolkit/boost/math/special_functions/detail/unchecked_factorial.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/special_functions/detail/unchecked_factorial.hpp (original)
+++ sandbox/math_toolkit/boost/math/special_functions/detail/unchecked_factorial.hpp 2007-08-19 12:37:56 EDT (Sun, 19 Aug 2007)
@@ -29,7 +29,7 @@
 template <>
 inline float unchecked_factorial<float>(unsigned i)
 {
- static const boost::array<float, 35> factorials = {
+ static const boost::array<float, 35> factorials = {{
       1.0F,
       1.0F,
       2.0F,
@@ -65,7 +65,7 @@
       0.26313083693369353016721801216e36F,
       0.868331761881188649551819440128e37F,
       0.29523279903960414084761860964352e39F,
- };
+ }};
 
    return factorials[i];
 }
@@ -80,7 +80,7 @@
 template <>
 inline long double unchecked_factorial<long double>(unsigned i)
 {
- static const boost::array<long double, 171> factorials = {
+ static const boost::array<long double, 171> factorials = {{
       1L,
       1L,
       2L,
@@ -252,7 +252,7 @@
       0.2526075744973198387538018869171341146786e303L,
       0.4269068009004705274939251888899566538069e305L,
       0.7257415615307998967396728211129263114717e307L,
- };
+ }};
 
    return factorials[i];
 }
@@ -279,7 +279,7 @@
 template <class T>
 inline T unchecked_factorial(unsigned i)
 {
- static const boost::array<T, 101> factorials = {
+ static const boost::array<T, 101> factorials = {{
       boost::lexical_cast<T>("1"),
       boost::lexical_cast<T>("1"),
       boost::lexical_cast<T>("2"),
@@ -381,7 +381,7 @@
       boost::lexical_cast<T>("9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000"),
       boost::lexical_cast<T>("933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000"),
       boost::lexical_cast<T>("93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000"),
- };
+ }};
 
    return factorials[i];
 }

Modified: sandbox/math_toolkit/libs/math/performance/main.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/performance/main.cpp (original)
+++ sandbox/math_toolkit/libs/math/performance/main.cpp 2007-08-19 12:37:56 EDT (Sun, 19 Aug 2007)
@@ -8,6 +8,7 @@
 #include <boost/math/tools/config.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include "performance_measure.hpp"
+#include <boost/math/policy/policy.hpp>
 
 extern void reference_evaluate();
 
@@ -78,6 +79,35 @@
    return found;
 }
 
+void print_current_config()
+{
+ std::cout << "Currently, polynomial evaluation uses method " << BOOST_MATH_POLY_METHOD << std::endl;
+ std::cout << "Currently, rational function evaluation uses method " << BOOST_MATH_RATIONAL_METHOD << std::endl;
+ if(BOOST_MATH_POLY_METHOD + BOOST_MATH_RATIONAL_METHOD > 0)
+ std::cout << "Currently, the largest order of polynomial or rational function"
+ " that uses a method other than 0, is " << BOOST_MATH_MAX_POLY_ORDER << std::endl;
+ bool uses_mixed_tables = boost::is_same<BOOST_MATH_INT_TABLE_TYPE(double, int), int>::value;
+ if(uses_mixed_tables)
+ std::cout << "Currently, rational functions with integer coefficients are evaluated using mixed integer/real arithmetic" << std::endl;
+ else
+ std::cout << "Currently, rational functions with integer coefficients are evaluated using all real arithmetic (integer coefficients are actually stored as reals)" << std::endl << std::endl;
+ std::cout << "Policies are currently set as follows:\n\n";
+ std::cout << "Policy Value\n";
+ std::cout << "BOOST_MATH_DOMAIN_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_DOMAIN_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_POLE_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_POLE_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_OVERFLOW_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_OVERFLOW_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_UNDERFLOW_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_UNDERFLOW_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_DENORM_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_DENORM_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_EVALUATION_ERROR_POLICY " << BOOST_STRINGIZE(BOOST_MATH_EVALUATION_ERROR_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_DIGITS10_POLICY " << BOOST_STRINGIZE(BOOST_MATH_DIGITS10_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_PROMOTE_FLOAT_POLICY " << BOOST_STRINGIZE(BOOST_MATH_PROMOTE_FLOAT_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_PROMOTE_DOUBLE_POLICY " << BOOST_STRINGIZE(BOOST_MATH_PROMOTE_DOUBLE_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_DISCRETE_QUANTILE_POLICY " << BOOST_STRINGIZE(BOOST_MATH_DISCRETE_QUANTILE_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_ASSERT_UNDEFINED_POLICY " << BOOST_STRINGIZE(BOOST_MATH_ASSERT_UNDEFINED_POLICY) << std::endl;
+ std::cout << "BOOST_MATH_MAX_ITER " << BOOST_STRINGIZE(BOOST_MATH_MAX_ITER) << std::endl;
+
+}
+
 int main(int argc, const char** argv)
 {
    try{
@@ -92,16 +122,7 @@
          }
          else if(std::strcmp(argv[i], "--tune") == 0)
          {
- std::cout << "Currently, polynomial evaluation uses method " << BOOST_MATH_POLY_METHOD << std::endl;
- std::cout << "Currently, rational function evaluation uses method " << BOOST_MATH_RATIONAL_METHOD << std::endl;
- if(BOOST_MATH_POLY_METHOD + BOOST_MATH_RATIONAL_METHOD > 0)
- std::cout << "Currently, the largest order of polynomial or rational function"
- " that uses a method other than 0, is " << BOOST_MATH_MAX_POLY_ORDER << std::endl;
- bool uses_mixed_tables = boost::is_same<BOOST_MATH_INT_TABLE_TYPE(double, int), int>::value;
- if(uses_mixed_tables)
- std::cout << "Currently, rational functions with integer coefficients are evaluated using mixed integer/real arithmetic" << std::endl;
- else
- std::cout << "Currently, rational functions with integer coefficients are evaluated using all real arithmetic (integer coefficients are actually stored as reals)" << std::endl;
+ print_current_config();
             add_named_test("Polynomial-method-0");
             add_named_test("Polynomial-method-1");
             add_named_test("Polynomial-method-2");
@@ -121,6 +142,7 @@
          }
          else if(std::strcmp(argv[i], "--all") == 0)
          {
+ print_current_config();
             std::set<test_info>::const_iterator a(all_tests().begin()), b(all_tests().end());
             while(a != b)
             {


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