From 396f854d6f47c1408ce673cd459eccef2440705b Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 22 May 2008 11:23:57 +0000 Subject: [PATCH] Split test_tr1 into two: one for long double, and one for float and double types. [SVN r45645] --- build/Jamfile.v2 | 4 ++++ test/Jamfile.v2 | 9 ++++++++- test/test_tr1.cpp | 25 +++++++++++++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 7ed791cd9..cf38e58a8 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -49,6 +49,8 @@ sph_legendre sph_neumann ; +compile has_long_double_support.cpp ; + lib boost_math_tr1 : ../src/tr1/$(TR1_SOURCES).cpp : shared:BOOST_MATH_TR1_DYN_LINK=1 @@ -62,6 +64,7 @@ lib boost_math_tr1f : ../src/tr1/$(TR1_SOURCES)f.cpp lib boost_math_tr1l : ../src/tr1/$(TR1_SOURCES)l.cpp : shared:BOOST_MATH_TR1_DYN_LINK=1 + has_long_double_support ; lib boost_math_c99 : ../src/tr1/$(C99_SOURCES).cpp @@ -77,5 +80,6 @@ lib boost_math_c99f : ../src/tr1/$(C99_SOURCES)f.cpp lib boost_math_c99l : ../src/tr1/$(C99_SOURCES)l.cpp : shared:BOOST_MATH_TR1_DYN_LINK=1 + has_long_double_support ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 672ce96ab..65b579d79 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -389,10 +389,17 @@ run test_policy_sf.cpp ; run test_tr1.cpp ../build//boost_math_tr1 ../build//boost_math_tr1f - ../build//boost_math_tr1l ../build//boost_math_c99 ../build//boost_math_c99f + ; + +run test_tr1.cpp + ../build//boost_math_tr1l ../build//boost_math_c99l + : : : + TEST_LD=1 + : + test_tr1_long_double ; compile compile_test/compl_abs_incl_test.cpp ; diff --git a/test/test_tr1.cpp b/test/test_tr1.cpp index 0c2da293a..05a175b4c 100644 --- a/test/test_tr1.cpp +++ b/test/test_tr1.cpp @@ -18,6 +18,7 @@ namespace tr1 = boost::math::tr1; void test_values(float, const char* name) { std::cout << "Testing type " << name << std::endl; +#ifndef TEST_LD // // First the C99 math functions: // @@ -645,12 +646,14 @@ void test_values(float, const char* name) BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(3, 2, static_cast(0.5)), static_cast(0.2061460599687871330692286791802688341213L), eps * 5000); BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40, 15, static_cast(0.75)), static_cast(-0.406036847302819452666908966769096223205057182668333862900509L), eps * 5000); +#endif } void test_values(double, const char* name) { std::cout << "Testing type " << name << std::endl; +#ifndef TEST_LD double eps = boost::math::tools::epsilon(); BOOST_CHECK_CLOSE(tr1::acosh(std::cosh(0.5)), 0.5, 500 * eps); BOOST_CHECK_CLOSE(tr1::asinh(std::sinh(0.5)), 0.5, 500 * eps); @@ -963,10 +966,12 @@ void test_values(double, const char* name) BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(3, 2, static_cast(0.5)), static_cast(0.2061460599687871330692286791802688341213L), eps * 5000); BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40, 15, static_cast(0.75)), static_cast(-0.406036847302819452666908966769096223205057182668333862900509L), eps * 5000); +#endif } void test_values(long double, const char* name) { +#ifdef TEST_LD #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS std::cout << "Testing type " << name << std::endl; @@ -1028,14 +1033,14 @@ void test_values(long double, const char* name) BOOST_CHECK(tr1::roundl(2.5L) == 3.0L); BOOST_CHECK(tr1::roundl(2.25L) == 2.0L); - BOOST_CHECK(tr1::nextafterf(1.0L, 2.0L) > 1.0L); - BOOST_CHECK(tr1::nextafterf(1.0L, -2.0L) < 1.0L); - BOOST_CHECK(tr1::nextafterf(tr1::nextafterf(1.0L, 2.0L), -2.0L) == 1.0L); - BOOST_CHECK(tr1::nextafterf(tr1::nextafterf(1.0L, -2.0L), 2.0L) == 1.0L); - BOOST_CHECK(tr1::nextafterf(1.0L, 2.0L) > 1.0L); - BOOST_CHECK(tr1::nextafterf(1.0L, -2.0L) < 1.0L); - BOOST_CHECK(tr1::nextafterf(tr1::nextafterf(1.0L, 2.0L), -2.0L) == 1.0L); - BOOST_CHECK(tr1::nextafterf(tr1::nextafterf(1.0L, -2.0L), 2.0L) == 1.0L); + BOOST_CHECK(tr1::nextafterl(1.0L, 2.0L) > 1.0L); + BOOST_CHECK(tr1::nextafterl(1.0L, -2.0L) < 1.0L); + BOOST_CHECK(tr1::nextafterl(tr1::nextafterl(1.0L, 2.0L), -2.0L) == 1.0L); + BOOST_CHECK(tr1::nextafterl(tr1::nextafterl(1.0L, -2.0L), 2.0L) == 1.0L); + BOOST_CHECK(tr1::nextafterl(1.0L, 2.0L) > 1.0L); + BOOST_CHECK(tr1::nextafterl(1.0L, -2.0L) < 1.0L); + BOOST_CHECK(tr1::nextafterl(tr1::nextafterl(1.0L, 2.0L), -2.0L) == 1.0L); + BOOST_CHECK(tr1::nextafterl(tr1::nextafterl(1.0L, -2.0L), 2.0L) == 1.0L); BOOST_CHECK(tr1::truncl(2.5L) == 2.0L); BOOST_CHECK(tr1::truncl(2.25L) == 2.0L); @@ -1595,14 +1600,18 @@ void test_values(long double, const char* name) BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(3L, 2L, static_cast(0.5L)), static_cast(0.2061460599687871330692286791802688341213L), eps * 5000L); BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40L, 15L, static_cast(0.75L)), static_cast(-0.406036847302819452666908966769096223205057182668333862900509L), eps * 5000L); #endif +#endif } int test_main(int, char* []) { +#ifndef TEST_LD test_values(1.0f, "float"); test_values(1.0, "double"); +#else #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_values(1.0L, "long double"); +#endif #endif return 0; }