Changeset 38762


Ignore:
Timestamp:
Aug 19, 2007, 4:37:56 PM (11 years ago)
Author:
John Maddock
Message:

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.

Location:
sandbox/math_toolkit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/math_toolkit/boost/math/policy/error_handling.hpp

    r38415 r38762  
    431431   if(fabs(val) > tools::max_value<R>())
    432432   {
    433       *result = static_cast<R>(raise_overflow_error<R>(function, 0, pol));
     433      *result = static_cast<R>(boost::math::policies::detail::raise_overflow_error<R>(function, 0, pol));
    434434      return true;
    435435   }
     
    441441   if((val != 0) && (static_cast<R>(val) == 0))
    442442   {
    443       *result = static_cast<R>(raise_underflow_error<R>(function, 0, pol));
     443      *result = static_cast<R>(boost::math::policies::detail::raise_underflow_error<R>(function, 0, pol));
    444444      return true;
    445445   }
     
    452452   if((fabs(val) < static_cast<T>(tools::min_value<R>())) && (static_cast<R>(val) != 0))
    453453   {
    454       *result = static_cast<R>(raise_denorm_error<R>(function, 0, static_cast<R>(val), pol));
     454      *result = static_cast<R>(boost::math::policies::detail::raise_denorm_error<R>(function, 0, static_cast<R>(val), pol));
    455455      return true;
    456456   }
  • sandbox/math_toolkit/boost/math/special_functions/detail/unchecked_factorial.hpp

    r7564 r38762  
    3030inline float unchecked_factorial<float>(unsigned i)
    3131{
    32    static const boost::array<float, 35> factorials = {
     32   static const boost::array<float, 35> factorials = {{
    3333      1.0F,
    3434      1.0F,
     
    6666      0.868331761881188649551819440128e37F,
    6767      0.29523279903960414084761860964352e39F,
    68    };
     68   }};
    6969
    7070   return factorials[i];
     
    8181inline long double unchecked_factorial<long double>(unsigned i)
    8282{
    83    static const boost::array<long double, 171> factorials = {
     83   static const boost::array<long double, 171> factorials = {{
    8484      1L,
    8585      1L,
     
    253253      0.4269068009004705274939251888899566538069e305L,
    254254      0.7257415615307998967396728211129263114717e307L,
    255    };
     255   }};
    256256
    257257   return factorials[i];
     
    280280inline T unchecked_factorial(unsigned i)
    281281{
    282    static const boost::array<T, 101> factorials = {
     282   static const boost::array<T, 101> factorials = {{
    283283      boost::lexical_cast<T>("1"),
    284284      boost::lexical_cast<T>("1"),
     
    382382      boost::lexical_cast<T>("933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000"),
    383383      boost::lexical_cast<T>("93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000"),
    384    };
     384   }};
    385385
    386386   return factorials[i];
  • sandbox/math_toolkit/libs/math/performance/main.cpp

    r38660 r38762  
    99#include <boost/type_traits/is_same.hpp>
    1010#include "performance_measure.hpp"
     11#include <boost/math/policy/policy.hpp>
    1112
    1213extern void reference_evaluate();
     
    7980}
    8081
     82void print_current_config()
     83{
     84   std::cout << "Currently, polynomial evaluation uses method " << BOOST_MATH_POLY_METHOD << std::endl;
     85   std::cout << "Currently, rational function evaluation uses method " << BOOST_MATH_RATIONAL_METHOD << std::endl;
     86   if(BOOST_MATH_POLY_METHOD + BOOST_MATH_RATIONAL_METHOD > 0)
     87      std::cout << "Currently, the largest order of polynomial or rational function"
     88         " that uses a method other than 0, is " << BOOST_MATH_MAX_POLY_ORDER << std::endl;
     89   bool uses_mixed_tables = boost::is_same<BOOST_MATH_INT_TABLE_TYPE(double, int), int>::value;
     90   if(uses_mixed_tables)
     91      std::cout << "Currently, rational functions with integer coefficients are evaluated using mixed integer/real arithmetic" << std::endl;
     92   else
     93      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;
     94   std::cout << "Policies are currently set as follows:\n\n";
     95   std::cout << "Policy                                  Value\n";
     96   std::cout << "BOOST_MATH_DOMAIN_ERROR_POLICY          " << BOOST_STRINGIZE(BOOST_MATH_DOMAIN_ERROR_POLICY) << std::endl;
     97   std::cout << "BOOST_MATH_POLE_ERROR_POLICY            " << BOOST_STRINGIZE(BOOST_MATH_POLE_ERROR_POLICY) << std::endl;
     98   std::cout << "BOOST_MATH_OVERFLOW_ERROR_POLICY        " << BOOST_STRINGIZE(BOOST_MATH_OVERFLOW_ERROR_POLICY) << std::endl;
     99   std::cout << "BOOST_MATH_UNDERFLOW_ERROR_POLICY       " << BOOST_STRINGIZE(BOOST_MATH_UNDERFLOW_ERROR_POLICY) << std::endl;
     100   std::cout << "BOOST_MATH_DENORM_ERROR_POLICY          " << BOOST_STRINGIZE(BOOST_MATH_DENORM_ERROR_POLICY) << std::endl;
     101   std::cout << "BOOST_MATH_EVALUATION_ERROR_POLICY      " << BOOST_STRINGIZE(BOOST_MATH_EVALUATION_ERROR_POLICY) << std::endl;
     102   std::cout << "BOOST_MATH_DIGITS10_POLICY              " << BOOST_STRINGIZE(BOOST_MATH_DIGITS10_POLICY) << std::endl;
     103   std::cout << "BOOST_MATH_PROMOTE_FLOAT_POLICY         " << BOOST_STRINGIZE(BOOST_MATH_PROMOTE_FLOAT_POLICY) << std::endl;
     104   std::cout << "BOOST_MATH_PROMOTE_DOUBLE_POLICY        " << BOOST_STRINGIZE(BOOST_MATH_PROMOTE_DOUBLE_POLICY) << std::endl;
     105   std::cout << "BOOST_MATH_DISCRETE_QUANTILE_POLICY     " << BOOST_STRINGIZE(BOOST_MATH_DISCRETE_QUANTILE_POLICY) << std::endl;
     106   std::cout << "BOOST_MATH_ASSERT_UNDEFINED_POLICY      " << BOOST_STRINGIZE(BOOST_MATH_ASSERT_UNDEFINED_POLICY) << std::endl;
     107   std::cout << "BOOST_MATH_MAX_ITER                     " << BOOST_STRINGIZE(BOOST_MATH_MAX_ITER) << std::endl;
     108
     109}
     110
    81111int main(int argc, const char** argv)
    82112{
     
    93123         else if(std::strcmp(argv[i], "--tune") == 0)
    94124         {
    95             std::cout << "Currently, polynomial evaluation uses method " << BOOST_MATH_POLY_METHOD << std::endl;
    96             std::cout << "Currently, rational function evaluation uses method " << BOOST_MATH_RATIONAL_METHOD << std::endl;
    97             if(BOOST_MATH_POLY_METHOD + BOOST_MATH_RATIONAL_METHOD > 0)
    98                std::cout << "Currently, the largest order of polynomial or rational function"
    99                   " that uses a method other than 0, is " << BOOST_MATH_MAX_POLY_ORDER << std::endl;
    100             bool uses_mixed_tables = boost::is_same<BOOST_MATH_INT_TABLE_TYPE(double, int), int>::value;
    101             if(uses_mixed_tables)
    102                std::cout << "Currently, rational functions with integer coefficients are evaluated using mixed integer/real arithmetic" << std::endl;
    103             else
    104                std::cout << "Currently, rational functions with integer coefficients are evaluated using all real arithmetic (integer coefficients are actually stored as reals)" << std::endl;
     125            print_current_config();
    105126            add_named_test("Polynomial-method-0");
    106127            add_named_test("Polynomial-method-1");
     
    122143         else if(std::strcmp(argv[i], "--all") == 0)
    123144         {
     145            print_current_config();
    124146            std::set<test_info>::const_iterator a(all_tests().begin()), b(all_tests().end());
    125147            while(a != b)
Note: See TracChangeset for help on using the changeset viewer.