Skip to content

Commit c71cda7

Browse files
Reimar Döffingerrdoeffinger
authored andcommitted
Update tests to take promote_double policy into account
Makes it easier to change its default to false in the future. Only adapting test_policy_8.cpp is now necessary to make tests pass after changing the default to false.
1 parent 8f843fd commit c71cda7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+75
-65
lines changed

test/test_0F1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void expected_results()
1616
//
1717
const char* largest_type;
1818
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
19-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
19+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
2020
{
2121
largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40";
2222
}

test/test_1F1.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void expected_results()
1515
//
1616
const char* largest_type;
1717
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
18-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
18+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
1919
{
2020
largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
2121
}
@@ -71,6 +71,8 @@ void expected_results()
7171
"Small.*", // test data group
7272
".*", 1000, 300); // test function
7373

74+
if(boost::math::policies::promote_double<>())
75+
{
7476
#if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
7577
//
7678
// long double has only a little extra precision and errors may creep
@@ -116,6 +118,7 @@ void expected_results()
116118
".*", 10, 5); // test function
117119

118120
#endif
121+
}
119122

120123
add_expected_result(
121124
".*", // compiler

test/test_1F1_log.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void expected_results()
1515
//
1616
const char* largest_type;
1717
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
18-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
18+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
1919
{
2020
largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
2121
}
@@ -72,6 +72,8 @@ void expected_results()
7272
".*", 1000, 300); // test function
7373

7474
#if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
75+
if(boost::math::policies::promote_double<>())
76+
{
7577
//
7678
// long double has only a little extra precision and errors may creep
7779
// into the double results:
@@ -106,7 +108,7 @@ void expected_results()
106108
"double", // test type(s)
107109
"Bug.*", // test data group
108110
".*", 300, 50); // test function
109-
111+
}
110112
#endif
111113

112114
add_expected_result(

test/test_1F1_regularized.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void expected_results()
1717
//
1818
const char* largest_type;
1919
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
20-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
20+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
2121
{
2222
largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
2323
}
@@ -74,6 +74,8 @@ void expected_results()
7474
".*", 1000, 300); // test function
7575

7676
#if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
77+
if(boost::math::policies::promote_double<>())
78+
{
7779
//
7880
// long double has only a little extra precision and errors may creep
7981
// into the double results:
@@ -108,7 +110,7 @@ void expected_results()
108110
"double", // test type(s)
109111
"Bug.*", // test data group
110112
".*", 300, 50); // test function
111-
113+
}
112114
#endif
113115

114116
add_expected_result(

test/test_2F0.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void expected_results()
1616
//
1717
const char* largest_type;
1818
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
19-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
19+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
2020
{
2121
largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40";
2222
}
@@ -29,7 +29,7 @@ void expected_results()
2929
#endif
3030

3131
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
32-
if (boost::math::policies::digits<double, boost::math::policies::policy<> >() != boost::math::policies::digits<long double, boost::math::policies::policy<> >())
32+
if (boost::math::policies::promote_double<>() && boost::math::policies::digits<double, boost::math::policies::policy<> >() != boost::math::policies::digits<long double, boost::math::policies::policy<> >())
3333
{
3434
add_expected_result(
3535
".*", // compiler

test/test_bessel_i.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void expected_results()
5151
//
5252
const char* largest_type;
5353
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
54-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
54+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
5555
{
5656
largest_type = "(long\\s+)?double";
5757
}

test/test_bessel_i_prime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void expected_results()
3737
//
3838
const char* largest_type;
3939
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
40-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
40+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
4141
{
4242
largest_type = "(long\\s+)?double";
4343
}

test/test_bessel_j.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void expected_results()
5151
//
5252
const char* largest_type;
5353
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
54-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
54+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
5555
{
5656
largest_type = "(long\\s+)?double|real_concept";
5757
}
@@ -197,6 +197,8 @@ void expected_results()
197197
BOOST_IF_CONSTEXPR ((std::numeric_limits<double>::digits != std::numeric_limits<long double>::digits)
198198
&& (std::numeric_limits<long double>::digits < 90))
199199
{
200+
if (boost::math::policies::promote_double<>())
201+
{
200202
// some errors spill over into type double as well:
201203
add_expected_result(
202204
".*", // compiler
@@ -226,6 +228,7 @@ void expected_results()
226228
"double", // test type(s)
227229
".*", // test data group
228230
".*", 30, 30); // test function
231+
}
229232
//
230233
// and we have a few cases with higher limits as well:
231234
//
@@ -251,7 +254,7 @@ void expected_results()
251254
".*(JN|j).*|.*Tricky.*", // test data group
252255
".*", 33000, 20000); // test function
253256
}
254-
else BOOST_IF_CONSTEXPR (std::numeric_limits<long double>::digits >= 90)
257+
else BOOST_IF_CONSTEXPR (boost::math::policies::promote_double<>() && std::numeric_limits<long double>::digits >= 90)
255258
{
256259
add_expected_result(
257260
".*", // compiler

test/test_bessel_j_prime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void expected_results()
3838
//
3939
const char* largest_type;
4040
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
41-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
41+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
4242
{
4343
largest_type = "(long\\s+)?double|real_concept";
4444
}
@@ -177,7 +177,7 @@ void expected_results()
177177

178178

179179
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
180-
if((std::numeric_limits<double>::digits != std::numeric_limits<long double>::digits)
180+
if(boost::math::policies::promote_double<>() && (std::numeric_limits<double>::digits != std::numeric_limits<long double>::digits)
181181
&& (std::numeric_limits<long double>::digits < 90))
182182
{
183183
// some errors spill over into type double as well:

test/test_bessel_k.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void expected_results()
5858
//
5959
const char* largest_type;
6060
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
61-
if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
61+
if(!boost::math::policies::promote_double<>() || boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
6262
{
6363
largest_type = "(long\\s+)?double|real_concept";
6464
}

0 commit comments

Comments
 (0)