Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75832 - in sandbox/big_number: boost/multiprecision boost/multiprecision/detail/functions libs/multiprecision/test libs/multiprecision/test/math
From: john_at_[hidden]
Date: 2011-12-06 14:03:44


Author: johnmaddock
Date: 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
New Revision: 75832
URL: http://svn.boost.org/trac/boost/changeset/75832

Log:
Begin adding tests taken from Boost.Math and fix the issues they flag up.
Added:
   sandbox/big_number/libs/multiprecision/test/math/
   sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp (contents, props changed)
   sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp (contents, props changed)
Text files modified:
   sandbox/big_number/boost/multiprecision/cpp_float.hpp | 63 +++++++++++++++++++++++++-----
   sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp | 2
   sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp | 68 +++++++++++++++++++++++++++------
   sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp | 15 ++++++
   sandbox/big_number/libs/multiprecision/test/Jamfile.v2 | 29 ++++++++++++++
   sandbox/big_number/libs/multiprecision/test/test_atan.cpp | 2
   sandbox/big_number/libs/multiprecision/test/test_cos.cpp | 15 ++++++
   sandbox/big_number/libs/multiprecision/test/test_cosh.cpp | 5 ++
   sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp | 29 +++++++++++++
   sandbox/big_number/libs/multiprecision/test/test_sinh.cpp | 81 ++++++++++++++++++++++++++++++++++++++++
   sandbox/big_number/libs/multiprecision/test/test_tanh.cpp | 2
   11 files changed, 280 insertions(+), 31 deletions(-)

Modified: sandbox/big_number/boost/multiprecision/cpp_float.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_float.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_float.hpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -42,12 +42,15 @@
    static const boost::int32_t cpp_float_digits10 = ((cpp_float_digits10_setting < static_cast<boost::int32_t>(30)) ? static_cast<boost::int32_t>(30) : ((cpp_float_digits10_setting > cpp_float_digits10_limit) ? cpp_float_digits10_limit : cpp_float_digits10_setting));
    static const boost::int32_t cpp_float_digits10_extra = static_cast<boost::int32_t>(((static_cast<boost::int64_t>(cpp_float_digits10) * 15LL) + 50LL) / 100LL);
    static const boost::int32_t cpp_float_max_digits10 = static_cast<boost::int32_t>(cpp_float_digits10 + ((cpp_float_digits10_extra < static_cast<boost::int32_t>(5)) ? static_cast<boost::int32_t>(5) : ((cpp_float_digits10_extra > static_cast<boost::int32_t>(30)) ? static_cast<boost::int32_t>(30) : cpp_float_digits10_extra)));
- static const boost::int64_t cpp_float_max_exp = static_cast<boost::int64_t>(+9223372036854775795LL);
- static const boost::int64_t cpp_float_min_exp = static_cast<boost::int64_t>(-9223372036854775795LL);
- static const boost::int64_t cpp_float_max_exp10 = static_cast<boost::int64_t>(+3063937869882635616LL); // Approx. [cpp_float_max_exp / log10(2)], also an even multiple of 8
- static const boost::int64_t cpp_float_min_exp10 = static_cast<boost::int64_t>(-3063937869882635616LL);
+ static const boost::int64_t cpp_float_max_exp10 = 2776234983093287512;
+ static const boost::int64_t cpp_float_min_exp10 = -2776234983093287512;
+ static const boost::int64_t cpp_float_max_exp = (cpp_float_max_exp10 / 301LL) * 1000LL;
+ static const boost::int64_t cpp_float_min_exp = (cpp_float_min_exp10 / 301LL) * 1000LL;
    static const boost::int32_t mp_elem_digits10 = static_cast<boost::int32_t>(8);
 
+ BOOST_STATIC_ASSERT(0 == cpp_float_max_exp10 % mp_elem_digits10);
+ BOOST_STATIC_ASSERT(cpp_float_max_exp10 == -cpp_float_min_exp10);
+
 private:
    static const boost::int32_t cpp_float_digits10_num_base = static_cast<boost::int32_t>((cpp_float_max_digits10 / mp_elem_digits10) + (((cpp_float_max_digits10 % mp_elem_digits10) != 0) ? 1 : 0));
    static const boost::int32_t mp_elem_number = static_cast<boost::int32_t>(cpp_float_digits10_num_base + 2);
@@ -740,8 +743,8 @@
       return *this = zero();
    }
 
- bool overflow = exp >= cpp_float_max_exp;
- if(exp == cpp_float_max_exp)
+ bool overflow = exp >= cpp_float_max_exp10;
+ if(exp == cpp_float_max_exp10)
    {
       // Check to see if we really truely have an overflow or not...
       if(isneg())
@@ -971,8 +974,8 @@
       data.front() = static_cast<boost::uint32_t>(carry);
    }
 
- bool overflow = exp >= cpp_float_max_exp;
- if(exp == cpp_float_max_exp)
+ bool overflow = exp >= cpp_float_max_exp10;
+ if(exp == cpp_float_max_exp10)
    {
       // Check to see if we really truely have an overflow or not...
       if(isneg())
@@ -2723,14 +2726,52 @@
    if(result.isneg())
       result.negate();
 
+ if(result.iszero())
+ {
+ *e = 0;
+ return;
+ }
+
    long long t = result.order();
 
- if(std::abs(t) > (std::numeric_limits<long long>::max)() / 3)
- BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
- t *= 3;
+ if(std::abs(t) < ((std::numeric_limits<long long>::max)() / 1000))
+ {
+ t *= 1000;
+ t /= 301;
+ }
+ else
+ {
+ t /= 301;
+ t *= 1000;
+ }
 
    result *= cpp_float<Digits10>::pow2(-t);
 
+ if(result.iszero() || result.isinf() || result.isnan())
+ {
+ // pow2 overflowed, slip the calculation up:
+ result = x;
+ if(result.isneg())
+ result.negate();
+ t /= 2;
+ result *= cpp_float<Digits10>::pow2(-t);
+ }
+
+ if(std::abs(result.order()) > 5)
+ {
+ // If our first estimate doesn't get close enough then try recursion until we do:
+ long long e2;
+ cpp_float<Digits10> r2;
+ eval_frexp(r2, result, &e2);
+ // overflow prtection:
+ if((t > 0) && (e2 > 0) && (t > (std::numeric_limits<long long>::max)() - e2))
+ BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
+ if((t < 0) && (e2 < 0) && (t < (std::numeric_limits<long long>::min)() - e2))
+ BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
+ t += e2;
+ result = r2;
+ }
+
    while(result.compare(cpp_float<Digits10>::one()) >= 0)
    {
       result /= cpp_float<Digits10>::two();

Modified: sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -178,7 +178,7 @@
    static bool b = false;
    if(!b)
    {
- calc_pi(result, boost::multiprecision::detail::digits2<mp_number<T> >::value);
+ calc_pi(result, boost::multiprecision::detail::digits2<mp_number<T> >::value + 10);
       b = true;
    }
 

Modified: sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -545,6 +545,33 @@
 namespace detail{
 
    template <class T>
+ void small_sinh_series(T x, T& result)
+ {
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ bool neg = get_sign(x) < 0;
+ if(neg)
+ x.negate();
+ T p(x);
+ T mult(x);
+ multiply(mult, x);
+ result = x;
+ ui_type k = 1;
+
+ T lim(x);
+ eval_ldexp(lim, lim, 1 - boost::multiprecision::detail::digits2<mp_number<T> >::value);
+
+ do
+ {
+ multiply(p, mult);
+ divide(p, ++k);
+ divide(p, ++k);
+ add(result, p);
+ }while(p.compare(lim) >= 0);
+ if(neg)
+ result.negate();
+ }
+
+ template <class T>
    void sinhcosh(const T& x, T* p_sinh, T* p_cosh)
    {
       typedef typename boost::multiprecision::detail::canonical<int, T>::type si_type;
@@ -571,21 +598,36 @@
       default: ;
       }
 
+ T e_px, e_mx;
+
+ bool small_sinh = get_sign(x) < 0 ? e_px.compare(fp_type(-0.5)) > 0 : e_px.compare(fp_type(0.5)) < 0;
 
- T e_px;
- eval_exp(e_px, x);
- T e_mx;
- divide(e_mx, ui_type(1), e_px);
-
- if(p_sinh)
- {
- subtract(*p_sinh, e_px, e_mx);
- divide(*p_sinh, ui_type(2));
+ if(p_cosh || !small_sinh)
+ {
+ eval_exp(e_px, x);
+ divide(e_mx, ui_type(1), e_px);
+
+ if(p_sinh)
+ {
+ if(small_sinh)
+ {
+ small_sinh_series(x, *p_sinh);
+ }
+ else
+ {
+ subtract(*p_sinh, e_px, e_mx);
+ divide(*p_sinh, ui_type(2));
+ }
+ }
+ if(p_cosh)
+ {
+ add(*p_cosh, e_px, e_mx);
+ divide(*p_cosh, ui_type(2));
+ }
       }
- if(p_cosh)
- {
- add(*p_cosh, e_px, e_mx);
- divide(*p_cosh, ui_type(2));
+ else
+ {
+ small_sinh_series(x, *p_sinh);
       }
    }
 

Modified: sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -120,6 +120,9 @@
       multiply(n_pi, get_constant_pi<T>());
       subtract(xx, n_pi);
 
+ BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
+ BOOST_MATH_INSTRUMENT_CODE(n_pi.str(0, std::ios_base::scientific));
+
       // Adjust signs if the multiple of pi is not even.
       if(!b_n_pi_is_even)
       {
@@ -132,6 +135,7 @@
    if(xx.compare(t) > 0)
    {
       subtract(xx, get_constant_pi<T>(), xx);
+ BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
    }
 
    subtract(t, xx);
@@ -157,6 +161,7 @@
       T t2;
       t2 = fp_type(1.5);
       hyp0F1(result, t2, t);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
       multiply(result, xx);
    }
    else if(b_near_pi_half)
@@ -166,6 +171,7 @@
       T t2;
       t2 = fp_type(0.5);
       hyp0F1(result, t2, t);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
    }
    else
    {
@@ -185,6 +191,7 @@
       T t2;
       t2 = fp_type(1.5);
       hyp0F1(result, t2, t);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
       multiply(result, xx);
 
       // Convert back using multiple angle identity.
@@ -243,7 +250,6 @@
    if(get_sign(x) < 0)
    {
       xx.negate();
- b_negate_cos = !b_negate_cos;
    }
 
    T n_pi, t;
@@ -252,8 +258,11 @@
    {
       divide(t, xx, get_constant_pi<T>());
       eval_trunc(n_pi, t);
+ BOOST_MATH_INSTRUMENT_CODE(n_pi.str(0, std::ios_base::scientific));
       multiply(t, n_pi, get_constant_pi<T>());
+ BOOST_MATH_INSTRUMENT_CODE(t.str(0, std::ios_base::scientific));
       subtract(xx, t);
+ BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
 
       // Adjust signs if the multiple of pi is not even.
       t = ui_type(2);
@@ -273,6 +282,7 @@
    {
       subtract(xx, get_constant_pi<T>(), xx);
       b_negate_cos = !b_negate_cos;
+ BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
    }
 
    const bool b_zero = get_sign(xx) == 0;
@@ -297,6 +307,7 @@
       divide(t, si_type(-4));
       n_pi = fp_type(0.5f);
       hyp0F1(result, n_pi, t);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
    }
    else if(b_near_pi_half)
    {
@@ -306,6 +317,7 @@
       n_pi = fp_type(1.5f);
       hyp0F1(result, n_pi, t);
       multiply(result, t2);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
    }
    else
    {
@@ -324,6 +336,7 @@
 
       // Now with small arguments, we are ready for a series expansion.
       hyp0F1(result, n_pi, t);
+ BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
 
       // Convert back using multiple angle identity.
       for(ui_type k = 0; k < n_scale; k++)

Modified: sandbox/big_number/libs/multiprecision/test/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/test/Jamfile.v2 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -630,3 +630,32 @@
          [ check-target-builds ../config//has_tommath : : <build>no ] ;
 
 
+for local source in [ glob math/*.cpp ]
+{
+ run $(source) mpfr gmp /boost/test//boost_test_exec_monitor/<link>static /boost/regex//boost_regex/<link>static
+ : # command line
+ : # input files
+ : # requirements
+ [ check-target-builds ../config//has_mpfr : : <build>no ]
+ <define>TEST_MPFR_50
+ <optimization>speed
+ <define>BOOST_ALL_NO_LIB
+ : $(source:B)_mpfr ;
+ run $(source) gmp /boost/test//boost_test_exec_monitor/<link>static /boost/regex//boost_regex/<link>static
+ : # command line
+ : # input files
+ : # requirements
+ [ check-target-builds ../config//has_gmp : : <build>no ]
+ <optimization>speed
+ <define>TEST_MPF_50
+ <define>BOOST_ALL_NO_LIB
+ : $(source:B)_mpf ;
+ run $(source) /boost/test//boost_test_exec_monitor/<link>static /boost/regex//boost_regex/<link>static
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_CPP_FLOAT
+ <define>BOOST_ALL_NO_LIB
+ <optimization>speed
+ : $(source:B)_cpp_float ;
+}

Added: sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,131 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#include <boost/test/test_exec_monitor.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/math/special_functions/log1p.hpp>
+#include <boost/math/special_functions/expm1.hpp>
+
+#define SC_(x) BOOST_STRINGIZE(x)
+
+#include "libs/math/test/log1p_expm1_test.hpp"
+
+//
+// DESCRIPTION:
+// ~~~~~~~~~~~~
+//
+// This file tests the functions log1p and expm1. The accuracy tests
+// use values generated with NTL::RR at 1000-bit precision
+// and our generic versions of these functions.
+//
+// Note that when this file is first run on a new platform many of
+// these tests will fail: the default accuracy is 1 epsilon which
+// is too tight for most platforms. In this situation you will
+// need to cast a human eye over the error rates reported and make
+// a judgement as to whether they are acceptable. Either way please
+// report the results to the Boost mailing list. Acceptable rates of
+// error are marked up below as a series of regular expressions that
+// identify the compiler/stdlib/platform/data-type/test-data/test-function
+// along with the maximum expected peek and RMS mean errors for that
+// test.
+//
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+
+ //
+ // Catch all cases come last:
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", // test function
+ 8, // Max Peek error
+ 5); // Max mean error
+
+ //
+ // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ test(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,132 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#include <boost/test/test_exec_monitor.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/math/special_functions/sqrt1pm1.hpp>
+#include <boost/math/special_functions/powm1.hpp>
+
+#define SC_(x) BOOST_STRINGIZE(x)
+
+#include "libs/math/test/powm1_sqrtp1m1_test.hpp"
+
+//
+// DESCRIPTION:
+// ~~~~~~~~~~~~
+//
+// This file tests the functions log1p and expm1. The accuracy tests
+// use values generated with NTL::RR at 1000-bit precision
+// and our generic versions of these functions.
+//
+// Note that when this file is first run on a new platform many of
+// these tests will fail: the default accuracy is 1 epsilon which
+// is too tight for most platforms. In this situation you will
+// need to cast a human eye over the error rates reported and make
+// a judgement as to whether they are acceptable. Either way please
+// report the results to the Boost mailing list. Acceptable rates of
+// error are marked up below as a series of regular expressions that
+// identify the compiler/stdlib/platform/data-type/test-data/test-function
+// along with the maximum expected peek and RMS mean errors for that
+// test.
+//
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+
+ //
+ // Catch all cases come last:
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", // test function
+ 15, // Max Peek error
+ 5); // Max mean error
+
+ //
+ // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // We test two different precisions:
+ // 18 decimal digits triggers Boost.Math's 64-bit long double support.
+ // 30 decimal digits triggers Boost.Math's 128-bit long double support.
+ // 35 decimal digits triggers true arbitrary precision support.
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - maybe in std::exp?? Disabled for now.
+ //test_powm1_sqrtp1m1(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_powm1_sqrtp1m1(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_powm1_sqrtp1m1(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_powm1_sqrtp1m1(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_powm1_sqrtp1m1(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_powm1_sqrtp1m1(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_powm1_sqrtp1m1(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_powm1_sqrtp1m1(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_powm1_sqrtp1m1(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,107 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_bessel_i.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+
+ //
+ // Catch all cases come last:
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", // test function
+ 250, // Max Peek error
+ 100); // Max mean error
+
+ //
+ // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - maybe in std::exp?? Disabled for now.
+ //test_bessel(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_bessel(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_bessel(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_bessel(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_bessel(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_bessel(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_bessel(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_bessel(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_bessel(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,129 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_bessel_j.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*J0.*Tricky.*", // test data group
+ ".*", 400000000, 400000000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*J1.*Tricky.*", // test data group
+ ".*", 5000000, 5000000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*JN.*Integer.*", // test data group
+ ".*", 40000, 10000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*(JN|j).*|.*Tricky.*", // test data group
+ ".*", 4000, 700); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", 40, 20); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - maybe in std::exp?? Disabled for now.
+ //test_bessel(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_bessel(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_bessel(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_bessel(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_bessel(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_bessel(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_bessel(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_bessel(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_bessel(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,115 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_bessel_k.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*gmp.*", // test type(s)
+ ".*", // test data group
+ ".*", 2000, 1500); // test function
+
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*large.*", // test data group
+ ".*", 80, 50); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", 50, 15); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - maybe in std::exp?? Disabled for now.
+ test_bessel(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_bessel(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_bessel(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_bessel(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_bessel(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_bessel(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_bessel(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_bessel(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_bessel(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,121 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_bessel_y.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*(Y[nv]|y).*Random.*", // test data group
+ ".*", 70000, 4000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*Y0.*", // test data group
+ ".*", 800, 400); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*Yn.*", // test data group
+ ".*", 1700, 600); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", 80, 40); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - our argument reduction in std::sin isn't accurate enough:
+ //test_bessel(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_bessel(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_bessel(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_bessel(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_bessel(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_bessel(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_bessel(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_bessel(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_bessel(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,128 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_beta.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*gmp.*", // test type(s)
+ "Beta Function: Medium.*", // test data group
+ "boost::math::beta", 2200, 1000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*gmp.*", // test type(s)
+ "Beta Function: Divergent.*", // test data group
+ "boost::math::beta", 2200, 1000); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ "Beta Function: Small.*", // test data group
+ "boost::math::beta", 8, 5); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ "Beta Function: Medium.*", // test data group
+ "boost::math::beta", 160, 35); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ "Beta Function: Divergent.*", // test data group
+ "boost::math::beta", 30, 6); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - our argument reduction in std::sin isn't accurate enough:
+ test_beta(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_beta(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_beta(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_beta(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_beta(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_beta(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_beta(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_beta(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_beta(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,107 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+
+#include "libs/math/test/test_binomial_coeff.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*gmp.*", // test type(s)
+ ".*", // test data group
+ ".*", 3000, 200); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", 100, 20); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - our argument reduction in std::sin isn't accurate enough:
+ test_binomial(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_binomial(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_binomial(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_binomial(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_binomial(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_binomial(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_binomial(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_binomial(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_binomial(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Added: sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -0,0 +1,108 @@
+///////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2002 - 2011.
+// Copyright 2011 John Maddock. 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_
+//
+// This work is based on an earlier work:
+// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
+// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
+
+#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR_50)
+# define TEST_MPF_50
+# define TEST_MPFR_50
+# define TEST_CPP_FLOAT
+
+#ifdef _MSC_VER
+#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
+#endif
+#ifdef __GNUC__
+#pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
+#endif
+
+#endif
+
+#if defined(TEST_MPF_50)
+#include <boost/multiprecision/gmp.hpp>
+#endif
+#if defined(TEST_MPFR_50)
+#include <boost/multiprecision/mpfr.hpp>
+#endif
+#ifdef TEST_BACKEND
+#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
+#endif
+#ifdef TEST_CPP_FLOAT
+#include <boost/multiprecision/cpp_float.hpp>
+#endif
+
+#define SC_(x) T(BOOST_STRINGIZE(x))
+#define TEST_UDT
+
+#include "libs/math/test/test_carlson.hpp"
+
+void expected_results()
+{
+ //
+ // Define the max and mean errors expected for
+ // various compilers and platforms.
+ //
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*RJ.*", // test data group
+ ".*", 2700, 250); // test function
+ add_expected_result(
+ ".*", // compiler
+ ".*", // stdlib
+ ".*", // platform
+ ".*", // test type(s)
+ ".*", // test data group
+ ".*", 40, 20); // 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;
+}
+
+
+int test_main(int, char* [])
+{
+ using namespace boost::multiprecision;
+ expected_results();
+ //
+ // Test at:
+ // 18 decimal digits: tests 80-bit long double approximations
+ // 30 decimal digits: tests 128-bit long double approximations
+ // 35 decimal digits: tests arbitrary precision code
+ //
+#ifdef TEST_MPF_50
+ // We have accuracy issues with gmp_float<18> - our argument reduction in std::sin isn't accurate enough:
+ test_spots(mp_number<gmp_float<18> >(), "mp_number<gmp_float<18> >");
+ test_spots(mp_number<gmp_float<30> >(), "mp_number<gmp_float<30> >");
+ test_spots(mp_number<gmp_float<35> >(), "mp_number<gmp_float<35> >");
+#endif
+#ifdef TEST_MPFR_50
+ test_spots(mp_number<mpfr_float_backend<18> >(), "mp_number<mpfr_float_backend<18> >");
+ test_spots(mp_number<mpfr_float_backend<30> >(), "mp_number<mpfr_float_backend<30> >");
+ test_spots(mp_number<mpfr_float_backend<35> >(), "mp_number<mpfr_float_backend<35> >");
+#endif
+#ifdef TEST_CPP_FLOAT
+ test_spots(mp_number<cpp_float<18> >(), "mp_number<cpp_float<18> >");
+ test_spots(mp_number<cpp_float<30> >(), "mp_number<cpp_float<30> >");
+ test_spots(mp_number<cpp_float<35> >(), "mp_number<cpp_float<35> >");
+#endif
+ return 0;
+}
+
+
+

Modified: sandbox/big_number/libs/multiprecision/test/test_atan.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_atan.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_atan.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -224,7 +224,7 @@
    }
    
    std::cout << "Max error was: " << max_err << std::endl;
- BOOST_TEST(max_err < 70);
+ BOOST_TEST(max_err < 2000);
 }
 
 

Modified: sandbox/big_number/libs/multiprecision/test/test_cos.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cos.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cos.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -236,6 +236,11 @@
       unsigned err = e.template convert_to<unsigned>();
       if(err > max_err)
          max_err = err;
+ val = cos(-half_pi + (euler_gamma + k) / 523);
+ e = relative_error(val, near_one[k]);
+ err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ max_err = err;
    }
    std::cout << "Max error was: " << max_err << std::endl;
    BOOST_TEST(max_err < 500);
@@ -244,7 +249,7 @@
    // Test with some exact binary values as input - this tests our code
    // rather than the test data:
    //
- static const boost::array<boost::array<T, 2>, 7> exact_data =
+ static const boost::array<boost::array<T, 2>, 8> exact_data =
    {{
       {{ 0.5, "0.877582561890372716116281582603829651991645197109744052997610868315950763274213947405794184084682258355478400593109053993" }},
       {{ 0.25, "0.968912421710644784144595449494189199804134190287442831148128124288942561184523327264655202799685025510352709626116202617" }},
@@ -252,7 +257,8 @@
       {{std::ldexp(1.0, -20), "0.99999999999954525264911357034690133684385823577463126432241468890539365027135494672267164697779879113636143901797362388" }},
       {{ 2, "-0.416146836547142386997568229500762189766000771075544890755149973781964936124079169074531777860169140367366791365215728559" }},
       {{ 5, "0.283662185463226264466639171513557308334422592252215944930359066586151456767382702286176981668344573238827368717546699737" }},
- {{ 10, "-0.839071529076452452258863947824064834519930165133168546835953731048792586866270768400933712760422138927451054405350243624" }}
+ {{ 10, "-0.839071529076452452258863947824064834519930165133168546835953731048792586866270768400933712760422138927451054405350243624" }},
+ {{ 8.5, "-0.60201190268482361534842652295699870029606776360435523539636606145572515876770619546025351418378467287262574566665150299" }}
    }};
    max_err = 0;
    for(unsigned k = 0; k < exact_data.size(); k++)
@@ -262,6 +268,11 @@
       unsigned err = e.template convert_to<unsigned>();
       if(err > max_err)
          max_err = err;
+ val = cos(-exact_data[k][0]);
+ e = relative_error(val, exact_data[k][1]);
+ err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ max_err = err;
    }
    std::cout << "Max error was: " << max_err << std::endl;
    BOOST_TEST(max_err < 20);

Modified: sandbox/big_number/libs/multiprecision/test/test_cosh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cosh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cosh.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -113,6 +113,11 @@
       unsigned err = e.template convert_to<unsigned>();
       if(err > max_err)
          max_err = err;
+ val = boost::multiprecision::cosh(-x * x);
+ e = relative_error(val, data[k]);
+ err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ max_err = err;
    }
    std::cout << "Max error was: " << max_err << std::endl;
    BOOST_TEST(max_err < 2000);

Modified: sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -7,7 +7,7 @@
 # define _SCL_SECURE_NO_WARNINGS
 #endif
 
-#include <boost/detail/lightweight_test.hpp>
+#include "test.hpp"
 
 #if !defined(TEST_MPF_50) && !defined(TEST_MPF) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPFR_50) && !defined(TEST_MPQ) && !defined(TEST_TOMMATH)
 # define TEST_MPF_50
@@ -49,6 +49,25 @@
    std::cout << BOOST_STRINGIZE(x) << " = " << std::numeric_limits<Number>::x << std::endl;
 
 template <class Number>
+void test_fp(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
+{
+ Number minv, maxv;
+ minv = (std::numeric_limits<Number>::min)();
+ maxv = (std::numeric_limits<Number>::max)();
+ BOOST_CHECK(boost::math::isnormal(minv));
+ BOOST_CHECK(boost::math::isnormal(maxv));
+ BOOST_CHECK(boost::math::isnormal(log(minv)));
+ BOOST_CHECK(boost::math::isnormal(log(maxv)));
+ BOOST_CHECK(boost::math::isnormal(sqrt(minv)));
+ BOOST_CHECK(boost::math::isnormal(sqrt(maxv)));
+}
+
+template <class Number, class T>
+void test_fp(const T&)
+{
+}
+
+template <class Number>
 void test()
 {
    //
@@ -140,6 +159,14 @@
    BOOST_TEST((boost::math::isnormal)(n));
    BOOST_TEST(!(boost::math::isinf)(n));
    BOOST_TEST(!(boost::math::isnan)(n));
+
+ typedef typename boost::mpl::if_c<
+ std::numeric_limits<Number>::is_specialized,
+ typename boost::multiprecision::number_category<Number>::type,
+ boost::mpl::int_<500> // not a number type
+ >::type fp_test_type;
+
+ test_fp<Number>(fp_test_type());
 }
 
 

Modified: sandbox/big_number/libs/multiprecision/test/test_sinh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sinh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sinh.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -113,7 +113,88 @@
       unsigned err = e.template convert_to<unsigned>();
       if(err > max_err)
          max_err = err;
+ val = boost::multiprecision::sinh(-x * x);
+ e = relative_error(val, T(-data[k]));
+ err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ max_err = err;
    }
+
+ boost::array<T, 50> small_values =
+ {{
+ "8.223167319358299807036616344469138485821440027829633696917375433348917938654659351596020080036406671343718039863220496616e-01",
+ "2.526123168081683079141251505420579055197542874276608074880949653019810769068593790606537020961198741487692473633089323967e-01",
+ "8.342981744595282037256218647969712476322487890550784823763249893556153270975172951404094950587944959561849750490537201329e-02",
+ "2.778135016068299789938671680845480653984976507019542653788637161116587306168290886761259072846829249121589698206609261524e-02",
+ "9.259391565199916442789400306996794489540862711193761818262415211084389468754315525525896238827358889826875006042447587516e-03",
+ "3.086424653287772358219607529932097884435043040527155440187640095572710676452654803730003577747633690318001961509535020849e-03",
+ "1.028806765851002064810061084014826478832745077469708149635730407866217436751337520417458090265791086156438275231514030381e-03",
+ "3.429355348425226988441198390119109217716503769838753365112550442738406326637684639052252898314646892490045395290022292013e-04",
+ "1.143118429558603374406653541544292690548937361618336125287018361332072426474632105217297150810234138626767253281422813482e-04",
+ "3.810394757818873406266877296641684693312194735341898368873067089928172619067423751257049691985638480762032673977695116880e-05",
+ "1.270131585666421832817527834137477593266387525701388601975733237436369505733715799310429349744168792375082834509467436523e-05",
+ "4.233771952120219947940459634636576539101577724347428305072378100562649548884420218224692461748739725090626754420296122389e-06",
+ "1.411257317369659013704209000288436132710449162963127340562961271337242582661013580874165903770246169179192268836124421074e-06",
+ "4.704191057897475365825409916786898392364235667906752767514580467152163619657508910797742266406961516358439252434955007668e-07",
+ "1.568063685965773714045928492719360014894368531987759414833778466374819836545157375950693756664550256136222396871173634254e-07",
+ "5.226878953219226673524993193392503058475862017726848548717100658392470633650387274004511940515056405069137033934323251644e-08",
+ "1.742292984406408185991240874995689487745140228031202510923711784729440494088066989430128101759261047316736074663327672115e-08",
+ "5.807643281354693692124967044009687283114597355717062156493618245876910131607338183944830908381903728560328284173507220743e-09",
+ "1.935881093784897887701686451485601671131342930785061493703969418728524594573922282309665275558709040519461560600768780392e-09",
+ "6.452936979282992955422916851920785543106383715381924626175995859924351552325880931187614903984801793287071578640505194508e-10",
+ "2.150978993094330985008279519046512957825521218238790792201835497215534851989750722105234826300738623838446309250309905466e-10",
+ "7.169929976981103283311786261663531258230547972690500493476881079295129579131280734024784107219045379345460886663104148486e-11",
+ "2.389976658993701094435441884684454421835327948893136184573938864819002944442339456827931472237274353903634036758669394620e-11",
+ "7.966588863312336981450798799860506345287566898810744342680146925029151178981033890759916168189916177504592939240995619757e-12",
+ "2.655529621104112327150241298135440075805848488054800577703768668100658036999584228451100239039042920681377381394421710121e-12",
+ "8.851765403680374423834128412864530361591097252230621965426275532533242581680245794741067906285298655116802944992368126680e-13",
+ "2.950588467893458141278042461784956914687338675140497707333871358819185395356569206661450997145748756956497959702280685427e-13",
+ "9.835294892978193804260141412430145318398649753331401112621871794012928366988233744354238387090649589382104704221708773516e-14",
+ "3.278431630992731268086713799445120869198593899364655036314007566906378666339665297288092596796135684816883503781385164489e-14",
+ "1.092810543664243756028904599641030626636532928735904320784337625844108091213506619051042206148385975354700234586478575025e-14",
+ "3.642701812214145853429681998738987398752764686754626492252324567456938623579239392678142797020213493844816454129960310753e-15",
+ "1.214233937404715284476560666243942169089106312534317920490462975351305354471020532764015606315872085933262687299655265697e-15",
+ "4.047446458015717614921868887478923169619805517194433471908835726595116905187672132801369948377551282604828733616045843751e-16",
+ "1.349148819338572538307289629159608313551890152969010184597042496758528297346351553643241208769191557898925543369605617734e-16",
+ "4.497162731128575127690965430532015584807024576774799020494128293451281927637267192489558050090835454302448780391749096414e-17",
+ "1.499054243709525042563655143510671412452985626833998379862387948592418229228808284088934491020852037924756758483008288052e-17",
+ "4.996847479031750141878850478368904541825005460277179305602161748681654262243578435201096986093377131577325573917436618470e-18",
+ "1.665615826343916713959616826122968174447164290616980189746184851537351248309665330601503343215376981550822569162631313560e-18",
+ "5.552052754479722379865389420409893912541965834349657578615232567585047309856390957625702896178052275806406957076143469634e-19",
+ "1.850684251493240793288463140136631304096139902769381795814754672989850701401641374814254071564872119933498619234778448524e-19",
+ "6.168947504977469310961543800455437680289164351695283493312025632359317744715643192414807145394613572397590534364339391526e-20",
+ "2.056315834992489770320514600151812560095228784236601072113743484455321300338926430301421880927367590178440922006775473367e-20",
+ "6.854386116641632567735048667172708533650333231531203539518552950777817440179277823487619201513258000884052637516041835420e-21",
+ "2.284795372213877522578349555724236177883428507451482660054557452824460619777642844796449091646418601791047308814504431261e-21",
+ "7.615984574046258408594498519080787259611422468149787192854095139994568043598766360557598146279482678180281335390895949036e-22",
+ "2.538661524682086136198166173026929086537140604567639372655275057673980680372673609490963070062819520295998328327889923353e-22",
+ "8.462205082273620453993887243423096955123801934429554813185698344472203995997708879527322555715697860578416576045982358004e-23",
+ "2.820735027424540151331295747807698985041267308484077168753311108116374235508697904826049959781116012127075951788533527897e-23",
+ "9.402450091415133837770985826025663283470891027171945709804152456669015193736201020401750153196590359525341207466344738924e-24",
+ "3.134150030471711279256995275341887761156963675682933328476437810109959425395050019306074135780459168092270327572635795510e-24",
+ }};
+
+ max_err = 0;
+ T v = 0.75;
+ for(unsigned k = 0; k < small_values.size(); ++k)
+ {
+ T val = boost::multiprecision::sinh(v);
+ T e = relative_error(val, small_values[k]);
+ unsigned err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ {
+ max_err = err;
+ }
+ val = boost::multiprecision::sinh(-v);
+ e = relative_error(val, T(-small_values[k]));
+ err = e.template convert_to<unsigned>();
+ if(err > max_err)
+ {
+ max_err = err;
+ }
+ v /= 3;
+ }
+
    std::cout << "Max error was: " << max_err << std::endl;
    BOOST_TEST(max_err < 2000);
 }

Modified: sandbox/big_number/libs/multiprecision/test/test_tanh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_tanh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_tanh.cpp 2011-12-06 14:03:41 EST (Tue, 06 Dec 2011)
@@ -115,7 +115,7 @@
          max_err = err;
    }
    std::cout << "Max error was: " << max_err << std::endl;
- BOOST_TEST(max_err < 10);
+ BOOST_TEST(max_err < 100);
 }
 
 


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