diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/math/test/float128 | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/math/test/float128')
34 files changed, 2213 insertions, 0 deletions
diff --git a/src/boost/libs/math/test/float128/log1p_expm1_test.cpp b/src/boost/libs/math/test/float128/log1p_expm1_test.cpp new file mode 100644 index 00000000..79486144 --- /dev/null +++ b/src/boost/libs/math/test/float128/log1p_expm1_test.cpp @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include <boost/math/special_functions/log1p.hpp> +#include <boost/math/special_functions/expm1.hpp> + +#include "table_type.hpp" + +#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; +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + 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 + // + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/powm1_sqrtp1m1_test.cpp b/src/boost/libs/math/test/float128/powm1_sqrtp1m1_test.cpp new file mode 100644 index 00000000..73972bb7 --- /dev/null +++ b/src/boost/libs/math/test/float128/powm1_sqrtp1m1_test.cpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" + +#include <boost/test/tools/floating_point_comparison.hpp> +#include <boost/math/special_functions/powm1.hpp> +#include <boost/math/special_functions/sqrt1pm1.hpp> + +#include "table_type.hpp" + +#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; +} + +template <class T> +void test(T t, const char* p) +{ + test_powm1_sqrtp1m1(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/setup.hpp b/src/boost/libs/math/test/float128/setup.hpp new file mode 100644 index 00000000..f71f5c98 --- /dev/null +++ b/src/boost/libs/math/test/float128/setup.hpp @@ -0,0 +1,29 @@ +// Copyright 2014 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_ + +#ifndef BOOST_MP_MATH_SETUP_HPP +#define BOOST_MP_MATH_SETUP_HPP + +#ifdef _MSC_VER +# define _SCL_SECURE_NO_WARNINGS +#endif + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include <boost/cstdfloat.hpp> +#include <boost/static_assert.hpp> + +#define ALL_TESTS test(boost::floatmax_t(0), "boost::floatmax_t"); +typedef boost::floatmax_t test_type_1; + +BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::floatmax_t>::digits == 113, "These tests should only be run for 128-bit floating point types."); + +#ifndef BOOST_MATH_TEST_TYPE +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/floating_point_comparison.hpp> +#endif + +#endif + diff --git a/src/boost/libs/math/test/float128/table_type.hpp b/src/boost/libs/math/test/float128/table_type.hpp new file mode 100644 index 00000000..6560762d --- /dev/null +++ b/src/boost/libs/math/test/float128/table_type.hpp @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////// +// Copyright 2012 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_ + +#ifndef BOOST_MP_TABLE_TYPE + +#include <libs/math/test/table_type.hpp> + +#define SC_(x) BOOST_FLOATMAX_C(x) + +#endif + diff --git a/src/boost/libs/math/test/float128/test_bessel_i.cpp b/src/boost/libs/math/test/float128/test_bessel_i.cpp new file mode 100644 index 00000000..952cc9d6 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_bessel_i.cpp @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/bessel.hpp> +#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 + 500, // Max Peek error + 200); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_bessel(t, p); +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_bessel_j.cpp b/src/boost/libs/math/test/float128/test_bessel_j.cpp new file mode 100644 index 00000000..7afeeebe --- /dev/null +++ b/src/boost/libs/math/test/float128/test_bessel_j.cpp @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/bessel.hpp> +#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 + ".*", 10000000, 5000000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*JN.*Integer.*", // test data group + ".*", 50000, 15000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*(JN|j).*|.*Tricky.*", // test data group + ".*", 7000, 3000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_bessel(t, p); +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_bessel_k.cpp b/src/boost/libs/math/test/float128/test_bessel_k.cpp new file mode 100644 index 00000000..a5ec1e2b --- /dev/null +++ b/src/boost/libs/math/test/float128/test_bessel_k.cpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/bessel.hpp> +#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 + ".*", // test type(s) + ".*large.*", // test data group + ".*", 80, 50); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 1000, 500); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_bessel(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_bessel_y.cpp b/src/boost/libs/math/test/float128/test_bessel_y.cpp new file mode 100644 index 00000000..55bdf56e --- /dev/null +++ b/src/boost/libs/math/test/float128/test_bessel_y.cpp @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/bessel.hpp> +#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 + ".*", 150, 60); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_bessel(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_beta.cpp b/src/boost/libs/math/test/float128/test_beta.cpp new file mode 100644 index 00000000..6cfddd56 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_beta.cpp @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/beta.hpp> +#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 + ".*", // test type(s) + "Beta Function: Small.*", // test data group + "beta", 8, 5); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Beta Function: Medium.*", // test data group + "beta", 1000, 750); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Beta Function: Divergent.*", // test data group + "beta", 1000, 700); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_beta(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_binomial_coeff.cpp b/src/boost/libs/math/test/float128/test_binomial_coeff.cpp new file mode 100644 index 00000000..be208f4f --- /dev/null +++ b/src/boost/libs/math/test/float128/test_binomial_coeff.cpp @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////// +// 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 + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/binomial.hpp> +#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 + ".*", // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_binomial(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + + diff --git a/src/boost/libs/math/test/float128/test_carlson.cpp b/src/boost/libs/math/test/float128/test_carlson.cpp new file mode 100644 index 00000000..14584937 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_carlson.cpp @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/ellint_rc.hpp> +#include <boost/math/special_functions/ellint_rd.hpp> +#include <boost/math/special_functions/ellint_rf.hpp> +#include <boost/math/special_functions/ellint_rj.hpp> +#include <boost/math/special_functions/ellint_rg.hpp> +#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; +} + +template <class T> +void test(T t, const char* p) +{ + test_spots(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_cbrt.cpp b/src/boost/libs/math/test/float128/test_cbrt.cpp new file mode 100644 index 00000000..d6690bdd --- /dev/null +++ b/src/boost/libs/math/test/float128/test_cbrt.cpp @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/cbrt.hpp> +#include "libs/math/test/test_cbrt.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) + ".*", // test data group + ".*", 5, 3); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_cbrt(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + + + diff --git a/src/boost/libs/math/test/float128/test_digamma.cpp b/src/boost/libs/math/test/float128/test_digamma.cpp new file mode 100644 index 00000000..9856223b --- /dev/null +++ b/src/boost/libs/math/test/float128/test_digamma.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/digamma.hpp> +#include "libs/math/test/test_digamma.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) + ".*negative.*", // test data group + ".*", 400, 200); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_digamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ellint_1.cpp b/src/boost/libs/math/test/float128/test_ellint_1.cpp new file mode 100644 index 00000000..5c259e94 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ellint_1.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/ellint_1.hpp> +#include "libs/math/test/test_ellint_1.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) + ".*", // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_spots(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ellint_2.cpp b/src/boost/libs/math/test/float128/test_ellint_2.cpp new file mode 100644 index 00000000..8b051246 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ellint_2.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/ellint_2.hpp> +#include "libs/math/test/test_ellint_2.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) + ".*", // test data group + ".*", 300, 200); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_spots(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ellint_3.cpp b/src/boost/libs/math/test/float128/test_ellint_3.cpp new file mode 100644 index 00000000..e4626838 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ellint_3.cpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/ellint_3.hpp> +#include "libs/math/test/test_ellint_3.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) + ".*Large.*", // test data group + ".*", 75, 40); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*Mathworld.*", // test data group + ".*", 600, 200); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 60, 30); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_spots(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_erf.cpp b/src/boost/libs/math/test/float128/test_erf.cpp new file mode 100644 index 00000000..90efd139 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_erf.cpp @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" +#define TEST_UDT + +#include <boost/math/special_functions/erf.hpp> +#include "libs/math/test/test_erf.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) + "Erf Function:.*", // test data group + "erfc?", 2500, 1000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Inverse Erf.*", // test data group + "erfc?_inv", 60, 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_erf(t, p); +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + 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 + // + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_expint.cpp b/src/boost/libs/math/test/float128/test_expint.cpp new file mode 100644 index 00000000..73a1f6bb --- /dev/null +++ b/src/boost/libs/math/test/float128/test_expint.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/expint.hpp> +#include "libs/math/test/test_expint.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) + ".*", // test data group + ".*", 5000, 2000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_expint(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_factorials.cpp b/src/boost/libs/math/test/float128/test_factorials.cpp new file mode 100644 index 00000000..36349fce --- /dev/null +++ b/src/boost/libs/math/test/float128/test_factorials.cpp @@ -0,0 +1,296 @@ +// Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifdef _MSC_VER +# pragma warning(disable: 4127) // conditional expression is constant. +# pragma warning(disable: 4245) // int/unsigned int conversion +#endif + +// Return infinities not exceptions: +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include <boost/cstdfloat.hpp> +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/floating_point_comparison.hpp> +#include <boost/math/special_functions/factorials.hpp> +#include <boost/math/special_functions/gamma.hpp> +#include <boost/math/tools/stats.hpp> +#include <boost/math/tools/test.hpp> + +#include <iostream> + using std::cout; + using std::endl; + +template <class T> +T naive_falling_factorial(T x, unsigned n) +{ + if(n == 0) + return 1; + T result = x; + while(--n) + { + x -= 1; + result *= x; + } + return result; +} + +template <class T> +void test_spots(T) +{ + // + // Basic sanity checks. + // + T tolerance = boost::math::tools::epsilon<T>() * 100 * 2; // 2 eps as a percent. + BOOST_CHECK_CLOSE( + ::boost::math::factorial<T>(0), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::factorial<T>(1), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::factorial<T>(10), + static_cast<T>(3628800L), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::unchecked_factorial<T>(0), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::unchecked_factorial<T>(1), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::unchecked_factorial<T>(10), + static_cast<T>(3628800L), tolerance); + + // + // Try some double factorials: + // + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(0), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(1), + static_cast<T>(1), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(2), + static_cast<T>(2), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(5), + static_cast<T>(15), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(10), + static_cast<T>(3840), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(19), + static_cast<T>(6.547290750e8Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(24), + static_cast<T>(1.961990553600000e12Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(33), + static_cast<T>(6.33265987076285062500000e18Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(42), + static_cast<T>(1.0714547155728479551488000000e26Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::double_factorial<T>(47), + static_cast<T>(1.19256819277443412353990764062500000e30Q), tolerance); + + if((std::numeric_limits<T>::has_infinity) && (std::numeric_limits<T>::max_exponent <= 1024)) + { + BOOST_CHECK_EQUAL( + ::boost::math::double_factorial<T>(320), + std::numeric_limits<T>::infinity()); + BOOST_CHECK_EQUAL( + ::boost::math::double_factorial<T>(301), + std::numeric_limits<T>::infinity()); + } + // + // Rising factorials: + // + tolerance = boost::math::tools::epsilon<T>() * 100 * 20; // 20 eps as a percent. + if(std::numeric_limits<T>::is_specialized == 0) + tolerance *= 5; // higher error rates without Lanczos support + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(3), 4), + static_cast<T>(360), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(7), -4), + static_cast<T>(0.00277777777777777777777777777777777777777777777777777777777778Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(120.5f), 8), + static_cast<T>(5.58187566784927180664062500e16Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(120.5f), -4), + static_cast<T>(5.15881498170104646868208445266116850161120996179812063177241e-9Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(5000.25f), 8), + static_cast<T>(3.92974581976666067544013393509103775024414062500000e29Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(5000.25f), -7), + static_cast<T>(1.28674092710208810281923019294164707555099052561945725535047e-26Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(30.25), 21), + static_cast<T>(3.93286957998925490693364184100209193343633629069699964020401e33Q), tolerance * 2); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(30.25), -21), + static_cast<T>(3.35010902064291983728782493133164809108646650368560147505884e-27Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), 21), + static_cast<T>(-9.76168312768123676601980433377916854311706629232503473758698e26Q), tolerance * 2); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), -21), + static_cast<T>(-1.50079704000923674318934280259377728203516775215430875839823e-34Q), 2 * tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), 5), + static_cast<T>(-1.78799177197265625000000e7Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), -5), + static_cast<T>(-2.47177487004482195012362027432181137141899692171397467859150e-8Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), 6), + static_cast<T>(4.5146792242309570312500000e8Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-30.25), -6), + static_cast<T>(6.81868929667537089689274558433603136943171564610751635473516e-10Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-3), 6), + static_cast<T>(0), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-3.25), 6), + static_cast<T>(2.99926757812500Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-5.25), 6), + static_cast<T>(50.987548828125000000000000Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-5.25), 13), + static_cast<T>(127230.91046623885631561279296875000Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-3.25), -6), + static_cast<T>(0.0000129609865918182348202632178291407500332449622510474437452125Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-5.25), -6), + static_cast<T>(2.50789821857946332294524052303699065683926911849535903362649e-6Q), tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::rising_factorial(static_cast<T>(-5.25), -13), + static_cast<T>(-1.38984989447269128946284683518361786049649013886981662962096e-14Q), tolerance); + + // + // Falling factorials: + // + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.25), 0), + static_cast<T>(naive_falling_factorial(30.25Q, 0)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.25), 1), + static_cast<T>(naive_falling_factorial(30.25Q, 1)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.25), 2), + static_cast<T>(naive_falling_factorial(30.25Q, 2)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.25), 5), + static_cast<T>(naive_falling_factorial(30.25Q, 5)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.25), 22), + static_cast<T>(naive_falling_factorial(30.25Q, 22)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(100.5), 6), + static_cast<T>(naive_falling_factorial(100.5Q, 6)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(30.75), 30), + static_cast<T>(naive_falling_factorial(30.75Q, 30)), + tolerance * 3); + if(boost::math::policies::digits<T, boost::math::policies::policy<> >() > 50) + { + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-30.75Q), 30), + static_cast<T>(naive_falling_factorial(-30.75Q, 30)), + tolerance * 3); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-30.75Q), 27), + static_cast<T>(naive_falling_factorial(-30.75Q, 27)), + tolerance * 3); + } + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-12.0), 6), + static_cast<T>(naive_falling_factorial(-12.0Q, 6)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-12), 5), + static_cast<T>(naive_falling_factorial(-12.0Q, 5)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-3.0), 6), + static_cast<T>(naive_falling_factorial(-3.0Q, 6)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(-3), 5), + static_cast<T>(naive_falling_factorial(-3.0Q, 5)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3.0), 6), + static_cast<T>(naive_falling_factorial(3.0Q, 6)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3), 5), + static_cast<T>(naive_falling_factorial(3.0Q, 5)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3.25), 4), + static_cast<T>(naive_falling_factorial(3.25Q, 4)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3.25), 5), + static_cast<T>(naive_falling_factorial(3.25Q, 5)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3.25), 6), + static_cast<T>(naive_falling_factorial(3.25Q, 6)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(3.25), 7), + static_cast<T>(naive_falling_factorial(3.25Q, 7)), + tolerance); + BOOST_CHECK_CLOSE( + ::boost::math::falling_factorial(static_cast<T>(8.25), 12), + static_cast<T>(naive_falling_factorial(8.25Q, 12)), + tolerance); + + + tolerance = boost::math::tools::epsilon<T>() * 100 * 20; // 20 eps as a percent. + unsigned i = boost::math::max_factorial<T>::value; + if((boost::is_floating_point<T>::value) && (sizeof(T) <= sizeof(double))) + { + // Without Lanczos support, tgamma isn't accurate enough for this test: + BOOST_CHECK_CLOSE( + ::boost::math::unchecked_factorial<T>(i), + boost::math::tgamma(static_cast<T>(i+1)), tolerance); + } + + i += 10; + while(boost::math::lgamma(static_cast<T>(i+1)) < boost::math::tools::log_max_value<T>()) + { + BOOST_CHECK_CLOSE( + ::boost::math::factorial<T>(i), + boost::math::tgamma(static_cast<T>(i+1)), tolerance); + i += 10; + } +} // template <class T> void test_spots(T) + +BOOST_AUTO_TEST_CASE( test_main ) +{ + BOOST_MATH_CONTROL_FP; + test_spots(0.0Q); + cout << "max factorial for __float128" << boost::math::max_factorial<boost::floatmax_t>::value << endl; +} + + + diff --git a/src/boost/libs/math/test/float128/test_gamma.cpp b/src/boost/libs/math/test/float128/test_gamma.cpp new file mode 100644 index 00000000..ddaae2ad --- /dev/null +++ b/src/boost/libs/math/test/float128/test_gamma.cpp @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/gamma.hpp> +#include "libs/math/test/test_gamma.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) + "near.*", // test data group + "tgamma", 200, 100); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "near.*", // test data group + "lgamma", 10000000, 10000000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "tgamma1pm1.*", // test data group + "tgamma1pm1", 1000, 150); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + "tgamma", 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_gamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_hermite.cpp b/src/boost/libs/math/test/float128/test_hermite.cpp new file mode 100644 index 00000000..f933c6d2 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_hermite.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/hermite.hpp> +#include "libs/math/test/test_hermite.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) + ".*", // test data group + "hermite", 10, 5); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_hermite(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ibeta.cpp b/src/boost/libs/math/test/float128/test_ibeta.cpp new file mode 100644 index 00000000..708a6950 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ibeta.cpp @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/beta.hpp> +#include "libs/math/test/test_ibeta.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) + "(?i).*small.*", // test data group + ".*", 90, 25); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + ".*", // test type(s) + "(?i).*medium.*", // test data group + ".*", 150, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + ".*", // test type(s) + "(?i).*large.*", // test data group + ".*", 150000, 5000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_beta(t, p); +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ibeta_inv_1.cpp b/src/boost/libs/math/test/float128/test_ibeta_inv_1.cpp new file mode 100644 index 00000000..68049024 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ibeta_inv_1.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/beta.hpp> +#include "libs/math/test/test_ibeta_inv.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) + ".*", // test data group + ".*", 1000000, 100000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_beta(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_ibeta_inv_ab_4.cpp b/src/boost/libs/math/test/float128/test_ibeta_inv_ab_4.cpp new file mode 100644 index 00000000..3e0bc858 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_ibeta_inv_ab_4.cpp @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" +#define TEST_UDT + +#define TEST_DATA 4 +#define FULL_TEST + +#include <boost/math/special_functions/beta.hpp> +#include "libs/math/test/test_ibeta_inv_ab.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) + ".*", // test data group + ".*", 10000, 1000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_beta(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + 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 + // + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_igamma.cpp b/src/boost/libs/math/test/float128/test_igamma.cpp new file mode 100644 index 00000000..d5332548 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_igamma.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/gamma.hpp> +#include "libs/math/test/test_igamma.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) + ".*large.*", // test data group + ".*", 20000000L, 1000000L); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 7000, 2000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_gamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_igamma_inv.cpp b/src/boost/libs/math/test/float128/test_igamma_inv.cpp new file mode 100644 index 00000000..122db9d4 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_igamma_inv.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/gamma.hpp> +#include "libs/math/test/test_igamma_inv.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) + ".*small.*", // test data group + ".*", 10000000L, 2500000L); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 7000, 2000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_gamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_igamma_inva.cpp b/src/boost/libs/math/test/float128/test_igamma_inva.cpp new file mode 100644 index 00000000..0a244c2f --- /dev/null +++ b/src/boost/libs/math/test/float128/test_igamma_inva.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/gamma.hpp> +#include "libs/math/test/test_igamma_inva.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) + ".*", // test data group + ".*", 7000, 2000); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_gamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_laguerre.cpp b/src/boost/libs/math/test/float128/test_laguerre.cpp new file mode 100644 index 00000000..04ae016b --- /dev/null +++ b/src/boost/libs/math/test/float128/test_laguerre.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/laguerre.hpp> +#include "libs/math/test/test_laguerre.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) + ".*", // test data group + ".*", 7000, 500); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_laguerre(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_legendre.cpp b/src/boost/libs/math/test/float128/test_legendre.cpp new file mode 100644 index 00000000..463c2d90 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_legendre.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/legendre.hpp> +#include "libs/math/test/test_legendre.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) + ".*", // test data group + ".*", 6000, 500); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_legendre_p(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_polygamma.cpp b/src/boost/libs/math/test/float128/test_polygamma.cpp new file mode 100644 index 00000000..e62cef9a --- /dev/null +++ b/src/boost/libs/math/test/float128/test_polygamma.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/polygamma.hpp> +#include "libs/math/test/test_polygamma.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) + ".*bug cases.*", // test data group + ".*", 100000, 40000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 700, 400); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_polygamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_std_lib.cpp b/src/boost/libs/math/test/float128/test_std_lib.cpp new file mode 100644 index 00000000..de42c105 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_std_lib.cpp @@ -0,0 +1,241 @@ +// Copyright John Maddock 2014. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/cstdfloat.hpp> +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/tools/floating_point_comparison.hpp> +#include <iostream> + +BOOST_AUTO_TEST_CASE( test_main ) +{ + // + // Basic tests that the functions which provide std lib supported are correctly wrapped: + // + boost::float128_t tol = std::numeric_limits<boost::float128_t>::epsilon() * 4; + boost::float128_t pi = BOOST_FLOAT128_C(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211); + + + BOOST_CHECK_EQUAL(std::abs(BOOST_FLOAT128_C(-2.0)), BOOST_FLOAT128_C(2.0)); + BOOST_CHECK_EQUAL(std::abs(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(2.0)); + BOOST_CHECK_EQUAL(std::fabs(BOOST_FLOAT128_C(-2.0)), BOOST_FLOAT128_C(2.0)); + BOOST_CHECK_EQUAL(std::fabs(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(2.0)); + + BOOST_CHECK_CLOSE_FRACTION(std::acos(BOOST_FLOAT128_C(0.25)), BOOST_FLOAT128_C(1.31811607165281796574566425464604046984639096659071471685355), tol); + BOOST_CHECK_CLOSE_FRACTION(std::acos(BOOST_FLOAT128_C(-0.25)), BOOST_FLOAT128_C(1.82347658193697527271697912863346241435077843278439110412140), tol); + BOOST_CHECK_CLOSE_FRACTION(std::acos(BOOST_FLOAT128_C(0.75)), BOOST_FLOAT128_C(0.722734247813415611178377352641333362025218486424440267626754), tol); + BOOST_CHECK_CLOSE_FRACTION(std::acos(BOOST_FLOAT128_C(-0.75)), BOOST_FLOAT128_C(2.41885840577637762728426603063816952217195091295066555334819), tol); + BOOST_CHECK_EQUAL(std::acos(BOOST_FLOAT128_C(1.0)), 0); + BOOST_CHECK_CLOSE_FRACTION(std::acos(BOOST_FLOAT128_C(0.0)), BOOST_FLOAT128_C(1.57079632679489661923132169163975144209858469968755291048747), tol); + + BOOST_CHECK_CLOSE_FRACTION(std::asin(BOOST_FLOAT128_C(0.25)), BOOST_FLOAT128_C(0.25268025514207865348565743699371097225219373309683819363392), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asin(BOOST_FLOAT128_C(-0.25)), BOOST_FLOAT128_C(-0.252680255142078653485657436993710972252193733096838193633924), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asin(BOOST_FLOAT128_C(0.75)), BOOST_FLOAT128_C(0.848062078981481008052944338998418080073366213263112642860718), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asin(BOOST_FLOAT128_C(-0.75)), BOOST_FLOAT128_C(-0.848062078981481008052944338998418080073366213263112642860718), tol); + BOOST_CHECK_EQUAL(std::asin(BOOST_FLOAT128_C(0.0)), 0); + BOOST_CHECK_CLOSE_FRACTION(std::asin(BOOST_FLOAT128_C(1.0)), BOOST_FLOAT128_C(1.57079632679489661923132169163975144209858469968755291048747), tol); + + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(0.25)), BOOST_FLOAT128_C(0.244978663126864154172082481211275810914144098381184067127376), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(-0.25)), BOOST_FLOAT128_C(-0.244978663126864154172082481211275810914144098381184067127376), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(1.25)), BOOST_FLOAT128_C(0.896055384571343956174800718029937827024578444846840487366551), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(-1.25)), BOOST_FLOAT128_C(-0.896055384571343956174800718029937827024578444846840487366551), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(10.25)), BOOST_FLOAT128_C(1.47354312854333084551799286825415639734160148773878671550090), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan(BOOST_FLOAT128_C(-10.25)), BOOST_FLOAT128_C(-1.47354312854333084551799286825415639734160148773878671550090), tol); + BOOST_CHECK_EQUAL(std::atan(BOOST_FLOAT128_C(0.0)), 0); + + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(0.5), BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(0.244978663126864154172082481211275810914144098381184067127376), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(-0.5), BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(-0.244978663126864154172082481211275810914144098381184067127376), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(0.5), BOOST_FLOAT128_C(-2.0)), BOOST_FLOAT128_C(-0.244978663126864154172082481211275810914144098381184067127376) + pi, tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(-0.5), BOOST_FLOAT128_C(-2.0)), BOOST_FLOAT128_C(0.244978663126864154172082481211275810914144098381184067127376) - pi, tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(2.0), BOOST_FLOAT128_C(0.0)), pi / 2, tol); + BOOST_CHECK_CLOSE_FRACTION(std::atan2(BOOST_FLOAT128_C(-2.0), BOOST_FLOAT128_C(0.0)), -pi / 2, tol); + BOOST_CHECK_EQUAL(std::atan2(BOOST_FLOAT128_C(0.0), BOOST_FLOAT128_C(0.0)), BOOST_FLOAT128_C(0.0)); + + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.479425538604203000273287935215571388081803367940600675188617), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.479425538604203000273287935215571388081803367940600675188617), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(0.997494986604054430941723371141487322706651425922115821949975), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(-0.997494986604054430941723371141487322706651425922115821949975), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(-0.350783227689619848120368800043635585084981735940583485415755), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sin(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(0.350783227689619848120368800043635585084981735940583485415755), tol); + BOOST_CHECK_EQUAL(std::sin(BOOST_FLOAT128_C(0.0)), 0); + + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.877582561890372716116281582603829651991645197109744052997611), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(0.877582561890372716116281582603829651991645197109744052997611), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(0.0707372016677029100881898514342687090850910275633468694226454), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(0.0707372016677029100881898514342687090850910275633468694226454), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(-0.936456687290796337698657626671760463019957765781959251620988), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cos(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(-0.936456687290796337698657626671760463019957765781959251620988), tol); + BOOST_CHECK_EQUAL(std::cos(BOOST_FLOAT128_C(0.0)), 1.0); + + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.546302489843790513255179465780285383297551720179791246164091), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.546302489843790513255179465780285383297551720179791246164091), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(14.1014199471717193876460836519877564456595435772358618661233), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(-14.1014199471717193876460836519877564456595435772358618661233), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(0.374585640158594666330512579989147388450882284289259230693023), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tan(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(-0.374585640158594666330512579989147388450882284289259230693023), tol); + BOOST_CHECK_EQUAL(std::tan(BOOST_FLOAT128_C(0.0)), 0.0); + + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.521095305493747361622425626411491559105928982611480527946094), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.521095305493747361622425626411491559105928982611480527946094), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(2.12927945509481749683438749467763164883178911950429386401441), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(-2.12927945509481749683438749467763164883178911950429386401441), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(16.5426272876349976249567315290124982237000338471151419910948), tol); + BOOST_CHECK_CLOSE_FRACTION(std::sinh(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(-16.5426272876349976249567315290124982237000338471151419910948), tol); + BOOST_CHECK_EQUAL(std::sinh(BOOST_FLOAT128_C(0.0)), 0); + + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(1.12762596520638078522622516140267201254784711809866748362899), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(1.12762596520638078522622516140267201254784711809866748362899), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(2.35240961524324732576766796544164417017396074886537319275824), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(2.35240961524324732576766796544164417017396074886537319275824), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(16.5728246710573161256965178213761180687716943793627989977661), tol); + BOOST_CHECK_CLOSE_FRACTION(std::cosh(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(16.5728246710573161256965178213761180687716943793627989977661), tol); + BOOST_CHECK_EQUAL(std::cosh(BOOST_FLOAT128_C(0.0)), 1.0); + + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.462117157260009758502318483643672548730289280330113038552732), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.462117157260009758502318483643672548730289280330113038552732), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(0.905148253644866438242303696456495597227641135158781798564224), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(-0.905148253644866438242303696456495597227641135158781798564224), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(3.5)), BOOST_FLOAT128_C(0.998177897611198709284273352450611717351703879477362867150362), tol); + BOOST_CHECK_CLOSE_FRACTION(std::tanh(BOOST_FLOAT128_C(-3.5)), BOOST_FLOAT128_C(-0.998177897611198709284273352450611717351703879477362867150362), tol); + BOOST_CHECK_EQUAL(std::tanh(BOOST_FLOAT128_C(0.0)), 0.0); + + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.481211825059603447497758913424368423135184334385660519661018), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.481211825059603447497758913424368423135184334385660519661018), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(1.19476321728710930411193082851909052353616207515300542927068), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(-1.5)), BOOST_FLOAT128_C(-1.19476321728710930411193082851909052353616207515300542927068), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(30.5)), BOOST_FLOAT128_C(4.11114250086321582491802557961818852029252495243356752882371), tol); + BOOST_CHECK_CLOSE_FRACTION(std::asinh(BOOST_FLOAT128_C(-30.5)), BOOST_FLOAT128_C(-4.11114250086321582491802557961818852029252495243356752882371), tol * 40); // extra tolerance required on Mingw-x64 at least + BOOST_CHECK_EQUAL(std::asinh(BOOST_FLOAT128_C(0.0)), 0); + + BOOST_CHECK_CLOSE_FRACTION(std::acosh(BOOST_FLOAT128_C(1.5)), BOOST_FLOAT128_C(0.962423650119206894995517826848736846270368668771321039322036), tol); + BOOST_CHECK_CLOSE_FRACTION(std::acosh(BOOST_FLOAT128_C(30.5)), BOOST_FLOAT128_C(4.11060501081175314729512161636335880294693070089674383785623), tol); + BOOST_CHECK_CLOSE_FRACTION(std::acosh(BOOST_FLOAT128_C(3000.5)), BOOST_FLOAT128_C(8.69968137322099085819002231042463682720224626990472395734493), tol); + BOOST_CHECK_EQUAL(std::acosh(BOOST_FLOAT128_C(1.0)), 0.0); + + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(0.5)), BOOST_FLOAT128_C(0.549306144334054845697622618461262852323745278911374725867347), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(-0.5)), BOOST_FLOAT128_C(-0.549306144334054845697622618461262852323745278911374725867347), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(0.75)), BOOST_FLOAT128_C(0.972955074527656652552676371721589864818542364790930594229695), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(-0.75)), BOOST_FLOAT128_C(-0.972955074527656652552676371721589864818542364790930594229695), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(0.125)), BOOST_FLOAT128_C(0.125657214140453038842568865200935839828948193031818857504999), tol); + BOOST_CHECK_CLOSE_FRACTION(std::atanh(BOOST_FLOAT128_C(-0.125)), BOOST_FLOAT128_C(-0.125657214140453038842568865200935839828948193031818857504999), tol); + BOOST_CHECK_EQUAL(std::atanh(BOOST_FLOAT128_C(0.0)), 0.0); + + BOOST_CHECK_EQUAL(std::ldexp(BOOST_FLOATMAX_C(2.5), 2), 2.5 * 4); + int i; + BOOST_CHECK_EQUAL(std::frexp(BOOST_FLOATMAX_C(16.0), &i), BOOST_FLOATMAX_C(0.5)); + BOOST_CHECK_EQUAL(std::floor(BOOST_FLOATMAX_C(2.5)), 2); + BOOST_CHECK_EQUAL(std::floor(BOOST_FLOATMAX_C(-2.5)), -3); + BOOST_CHECK_EQUAL(std::ceil(BOOST_FLOATMAX_C(2.5)), 3); + BOOST_CHECK_EQUAL(std::ceil(BOOST_FLOATMAX_C(-2.5)), -2); + BOOST_CHECK_EQUAL(std::trunc(BOOST_FLOATMAX_C(2.5)), 2); + BOOST_CHECK_EQUAL(std::trunc(BOOST_FLOATMAX_C(-2.5)), -2); + + BOOST_CHECK_CLOSE_FRACTION(std::sqrt(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(1.41421356237309504880168872420969807856967187537694807317668), tol); + BOOST_CHECK_CLOSE_FRACTION(std::exp(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(7.38905609893065022723042746057500781318031557055184732408713), tol); + BOOST_CHECK_CLOSE_FRACTION(std::exp(BOOST_FLOAT128_C(2000.0)), BOOST_FLOAT128_C(3.88118019428436857648232207537185146709138266970427068956343e868), tol * 500); + BOOST_CHECK_CLOSE_FRACTION(std::exp(BOOST_FLOAT128_C(-2.0)), 1 / BOOST_FLOAT128_C(7.38905609893065022723042746057500781318031557055184732408713), tol); + BOOST_CHECK_CLOSE_FRACTION(std::exp(BOOST_FLOAT128_C(-2000.0)), 1 / BOOST_FLOAT128_C(3.88118019428436857648232207537185146709138266970427068956343e868), tol * 500); + BOOST_CHECK_CLOSE_FRACTION(std::pow(BOOST_FLOAT128_C(2.5), BOOST_FLOAT128_C(2.5)), BOOST_FLOAT128_C(9.88211768802618541249654232635224541787360981039130258392970), tol); + BOOST_CHECK_CLOSE_FRACTION(std::pow(BOOST_FLOAT128_C(2.5), -BOOST_FLOAT128_C(2.5)), 1 / BOOST_FLOAT128_C(9.88211768802618541249654232635224541787360981039130258392970), tol); + + BOOST_CHECK_CLOSE_FRACTION(std::log(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(0.693147180559945309417232121458176568075500134360255254120680), tol); + BOOST_CHECK_CLOSE_FRACTION(std::log(BOOST_FLOAT128_C(2000.0)), BOOST_FLOAT128_C(7.60090245954208236147120648551126919087880460024657418222066), tol); + BOOST_CHECK_CLOSE_FRACTION(std::log10(BOOST_FLOAT128_C(2.0)), BOOST_FLOAT128_C(0.301029995663981195213738894724493026768189881462108541310427), tol); + BOOST_CHECK_CLOSE_FRACTION(std::log10(BOOST_FLOAT128_C(2000.0)), BOOST_FLOAT128_C(3.30102999566398119521373889472449302676818988146210854131043), tol); + + BOOST_CHECK_EQUAL(std::fmod(BOOST_FLOATMAX_C(20.0), BOOST_FLOATMAX_C(7.0)), BOOST_FLOATMAX_C(6.0)); + BOOST_CHECK_EQUAL(std::fmod(-BOOST_FLOATMAX_C(20.0), BOOST_FLOATMAX_C(7.0)), -BOOST_FLOATMAX_C(6.0)); + BOOST_CHECK_EQUAL(std::fmod(BOOST_FLOATMAX_C(20.0), -BOOST_FLOATMAX_C(7.0)), BOOST_FLOATMAX_C(6.0)); + BOOST_CHECK_EQUAL(std::fmod(-BOOST_FLOATMAX_C(20.0), -BOOST_FLOATMAX_C(7.0)), -BOOST_FLOATMAX_C(6.0)); + // + // Basic tests of complex number support: + // + std::complex<boost::floatmax_t> cm(2.5, 3.5); + std::complex<double> cd(2.5, 3.5); + BOOST_CHECK_EQUAL(real(cm), BOOST_FLOATMAX_C(2.5)); + BOOST_CHECK_EQUAL(imag(cm), BOOST_FLOATMAX_C(3.5)); + BOOST_CHECK_CLOSE_FRACTION(abs(cm), std::sqrt(real(cm) * real(cm) + imag(cm) * imag(cm)), tol); + BOOST_CHECK_CLOSE_FRACTION(arg(cm), std::atan2(imag(cm), real(cm)), tol); + BOOST_CHECK_EQUAL(norm(cm), norm(cd)); + BOOST_CHECK_EQUAL(conj(cm), std::complex<boost::floatmax_t>(2.5, -3.5)); + BOOST_CHECK_EQUAL(proj(cm), cm); + if (std::numeric_limits<boost::floatmax_t>::has_infinity) + { + boost::floatmax_t m = (std::numeric_limits<boost::floatmax_t>::max)(); + boost::floatmax_t n = (std::numeric_limits<boost::floatmax_t>::quiet_NaN)(); + boost::floatmax_t i = std::numeric_limits<boost::floatmax_t>::infinity(); + std::complex<boost::floatmax_t> ci(i, 0); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(i, 2.5)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(i, -2.5)), std::conj(ci)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-i, 2.5)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-i, -2.5)), std::conj(ci)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(2.5, i)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-2.5, i)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(2.5, -i)), std::conj(ci)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-2.5, -i)), std::conj(ci)); + // If there's a NaN and an infinity, then we treat it as an infinity: + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(i, n)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-i, n)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(n, i)), ci); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(n, -i)), std::conj(ci)); + // Maximum values should not be detected as infinities: + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(m, 2.5)), std::complex<boost::floatmax_t>(m, 2.5)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(m, -2.5)), std::complex<boost::floatmax_t>(m, -2.5)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-m, 2.5)), std::complex<boost::floatmax_t>(-m, 2.5)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-m, -2.5)), std::complex<boost::floatmax_t>(-m, -2.5)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(2.5, m)), std::complex<boost::floatmax_t>(2.5, m)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-2.5, m)), std::complex<boost::floatmax_t>(-2.5, m)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(2.5, -m)), std::complex<boost::floatmax_t>(2.5, -m)); + BOOST_CHECK_EQUAL(proj(std::complex<boost::floatmax_t>(-2.5, -m)), std::complex<boost::floatmax_t>(-2.5, -m)); + } + BOOST_CHECK_CLOSE_FRACTION(real(cm), real(std::polar(abs(cm), arg(cm))), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(cm), imag(std::polar(abs(cm), arg(cm))), tol); + BOOST_CHECK_CLOSE_FRACTION(real(sqrt(cm)), BOOST_FLOATMAX_C(1.84406651636014927478967924702313083926924795108746617689331), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(sqrt(cm)), BOOST_FLOATMAX_C(0.94898962942734874384477674565646902214428238312030745589860), tol); + + BOOST_CHECK_CLOSE_FRACTION(real(sin(cm)), BOOST_FLOATMAX_C(9.9183739147466194779705692590714075536609528502804512321829), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(sin(cm)), BOOST_FLOATMAX_C(-13.2530202358612673933065316490414418905222985108088743924151), tol); + BOOST_CHECK_CLOSE_FRACTION(real(cos(cm)), BOOST_FLOATMAX_C(-13.2772126767962806757640045050809172681765101364150115572273), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(cos(cm)), BOOST_FLOATMAX_C(-9.9003016219435352532718399415663308886142356901813313808396), tol); + BOOST_CHECK_CLOSE_FRACTION(real(tan(cm)), BOOST_FLOATMAX_C(-0.001747945781533807475041571346335555146588886236426940282142), 100 * tol); + BOOST_CHECK_CLOSE_FRACTION(imag(tan(cm)), BOOST_FLOATMAX_C(0.999481272866023968509371163341197364669909311495225118348783), tol); + + BOOST_CHECK_CLOSE_FRACTION(real(asin(cm)), BOOST_FLOATMAX_C(0.60763873377718961061236721540807625716707363115177473522038), 3 * tol); + BOOST_CHECK_CLOSE_FRACTION(imag(asin(cm)), BOOST_FLOATMAX_C(2.15662466247239925020341473126370983708442367609452933444142), tol); + BOOST_CHECK_CLOSE_FRACTION(real(acos(cm)), BOOST_FLOATMAX_C(0.96315759301770700861895447623167518493151106853577817526710), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(acos(cm)), BOOST_FLOATMAX_C(-2.15662466247239925020341473126370983708442367609452933444142), tol); + BOOST_CHECK_CLOSE_FRACTION(real(atan(cm)), BOOST_FLOATMAX_C(1.43164649729234094356720655652341656334194939189977737526797), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(atan(cm)), BOOST_FLOATMAX_C(0.18785402217098027123573761814417062282719376109354553980571), tol); + + BOOST_CHECK_CLOSE_FRACTION(real(exp(cm)), BOOST_FLOATMAX_C(-11.40837793738050755301628098123357473395267691300165885963084), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(exp(cm)), BOOST_FLOATMAX_C(-4.27341455284486523762268047763120025488336663280501044879428), tol); + BOOST_CHECK_CLOSE_FRACTION(real(log(cm)), BOOST_FLOATMAX_C(1.45888536604213956747543177478663529791228872640369045476212), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(log(cm)), BOOST_FLOATMAX_C(0.95054684081207514789478913546381917504767901030880427426177), tol); + BOOST_CHECK_CLOSE_FRACTION(real(pow(cm, cm)), BOOST_FLOATMAX_C(0.500085941796692509786065254311643761781309406813392318413211), 3 * tol); + BOOST_CHECK_CLOSE_FRACTION(imag(pow(cm, cm)), BOOST_FLOATMAX_C(1.2835619023632800631240903890826362708871896445947786884), tol); + BOOST_CHECK_CLOSE_FRACTION(real(pow(cm, 45)), BOOST_FLOATMAX_C(1.15295630001810518909457669488131135702133178710937500000000e28), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(pow(cm, 45)), BOOST_FLOATMAX_C(-3.03446103291767290317331113291188915967941284179687500000000e28), tol); + BOOST_CHECK_CLOSE_FRACTION(real(pow(cm, BOOST_FLOATMAX_C(-6.25))), BOOST_FLOATMAX_C(0.0001033088262386741675929555572265687059620746178809486273109638), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(pow(cm, BOOST_FLOATMAX_C(-6.25))), BOOST_FLOATMAX_C(0.000036807924520680371147635577932953977554657684086220380643819), 10*tol); + BOOST_CHECK_CLOSE_FRACTION(real(pow(BOOST_FLOATMAX_C(23.125), cm)), BOOST_FLOATMAX_C(-6.10574617260000071495777483951769228578270070743952693687), 500*tol); + BOOST_CHECK_CLOSE_FRACTION(imag(pow(BOOST_FLOATMAX_C(23.125), cm)), BOOST_FLOATMAX_C(-2571.59829653692515304089117319850284971907684832627401081405), tol); + + BOOST_CHECK_CLOSE_FRACTION(real(sinh(cm)), BOOST_FLOATMAX_C(-5.66575444574645085564435171738630834083691435582030649964506), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(sinh(cm)), BOOST_FLOATMAX_C(-2.15110429680352723029881676360397937637837569516923953471257), tol); + BOOST_CHECK_CLOSE_FRACTION(real(cosh(cm)), BOOST_FLOATMAX_C(-5.74262349163405669737192926384726639311576255718135235998578), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(cosh(cm)), BOOST_FLOATMAX_C(-2.12231025604133800732386371402722087850499093763577091408171), tol); + BOOST_CHECK_CLOSE_FRACTION(real(tanh(cm)), BOOST_FLOATMAX_C(0.989853240015864535514963496600761619743140454542828561309980), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(tanh(cm)), BOOST_FLOATMAX_C(0.008764045495134631601280624388444235039135499546704045953309), 12 * tol); + + BOOST_CHECK_CLOSE_FRACTION(real(asinh(cm)), BOOST_FLOATMAX_C(2.14787287976856126021628946626513750583054633606189652982666), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(asinh(cm)), BOOST_FLOATMAX_C(0.93760050284009400234857022775555923392488940926800031416598), tol); + BOOST_CHECK_CLOSE_FRACTION(real(acosh(cm)), BOOST_FLOATMAX_C(2.15662466247239925020341473126370983708442367609452933444142), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(acosh(cm)), BOOST_FLOATMAX_C(0.96315759301770700861895447623167518493151106853577817526710), tol); + BOOST_CHECK_CLOSE_FRACTION(real(atanh(cm)), BOOST_FLOATMAX_C(0.131131117031038145756858363631111963444914136310244574499277), tol); + BOOST_CHECK_CLOSE_FRACTION(imag(atanh(cm)), BOOST_FLOATMAX_C(1.380543138238714176079527733234534889849881842858502491699319), 12 * tol); +} + + + diff --git a/src/boost/libs/math/test/float128/test_tgamma_ratio.cpp b/src/boost/libs/math/test/float128/test_tgamma_ratio.cpp new file mode 100644 index 00000000..9d2568f5 --- /dev/null +++ b/src/boost/libs/math/test/float128/test_tgamma_ratio.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/gamma.hpp> +#include "libs/math/test/test_tgamma_ratio.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) + ".*", // test data group + ".*", 2000, 500); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_tgamma_ratio(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_trigamma.cpp b/src/boost/libs/math/test/float128/test_trigamma.cpp new file mode 100644 index 00000000..8862b53d --- /dev/null +++ b/src/boost/libs/math/test/float128/test_trigamma.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/trigamma.hpp> +#include "libs/math/test/test_trigamma.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) + ".*", // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_trigamma(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + diff --git a/src/boost/libs/math/test/float128/test_zeta.cpp b/src/boost/libs/math/test/float128/test_zeta.cpp new file mode 100644 index 00000000..4dcdf19c --- /dev/null +++ b/src/boost/libs/math/test/float128/test_zeta.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////// +// 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_ + +#include "setup.hpp" +#include "table_type.hpp" + +#include <boost/math/special_functions/zeta.hpp> +#include "libs/math/test/test_zeta.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) + ".*", // test data group + ".*", 1000, 200); // 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; +} + +template <class T> +void test(T t, const char* p) +{ + test_zeta(t, p); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + expected_results(); + ALL_TESTS +} + |