mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Split test_tr1 into two: one for long double, and one for float and double types.
[SVN r45645]
This commit is contained in:
@@ -49,6 +49,8 @@ sph_legendre
|
||||
sph_neumann
|
||||
;
|
||||
|
||||
compile has_long_double_support.cpp ;
|
||||
|
||||
lib boost_math_tr1 : ../src/tr1/$(TR1_SOURCES).cpp
|
||||
:
|
||||
<link>shared:<define>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
|
||||
:
|
||||
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
|
||||
<dependency>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
|
||||
:
|
||||
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
|
||||
<dependency>has_long_double_support
|
||||
;
|
||||
|
||||
|
||||
@@ -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
|
||||
: : :
|
||||
<define>TEST_LD=1
|
||||
:
|
||||
test_tr1_long_double
|
||||
;
|
||||
|
||||
compile compile_test/compl_abs_incl_test.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<float>(0.5)), static_cast<float>(0.2061460599687871330692286791802688341213L), eps * 5000);
|
||||
BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40, 15, static_cast<float>(0.75)), static_cast<float>(-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<double>();
|
||||
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<double>(0.5)), static_cast<double>(0.2061460599687871330692286791802688341213L), eps * 5000);
|
||||
BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40, 15, static_cast<double>(0.75)), static_cast<double>(-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<long double>(0.5L)), static_cast<long double>(0.2061460599687871330692286791802688341213L), eps * 5000L);
|
||||
BOOST_CHECK_CLOSE_FRACTION(tr1::sph_legendre(40L, 15L, static_cast<long double>(0.75L)), static_cast<long double>(-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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user