mirror of
https://github.com/boostorg/math.git
synced 2026-02-02 21:02:20 +00:00
Merge changes from Trunk:
* Fix common_factor code so it works with expression-template enabled types, and added new tests. * Cleaned up using declarations. * Fixed cbrt conceptual requirements. * Fixed round for negative values. * Changed all configuration code to use the new Boost.Build configuration support. * Fixed HP aCC version numbers in src files. * Regenerated docs. [SVN r62124]
This commit is contained in:
@@ -48,6 +48,12 @@ void check_within_half(T a, U u)
|
||||
std::cerr << "Values were: " << std::setprecision(35) << std::setw(40)
|
||||
<< std::left << a << u << std::endl;
|
||||
}
|
||||
if((fabs(a - u) == 0.5f) && (fabs(static_cast<T>(u)) < fabs(a)))
|
||||
{
|
||||
BOOST_ERROR("Rounded result was towards zero with boost::round");
|
||||
std::cerr << "Values were: " << std::setprecision(35) << std::setw(40)
|
||||
<< std::left << a << u << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -75,6 +81,12 @@ void check_trunc_result(T a, U u)
|
||||
std::cerr << "Values were: " << std::setprecision(35) << std::setw(40)
|
||||
<< std::left << a << u << std::endl;
|
||||
}
|
||||
if(fabs(static_cast<T>(u)) > fabs(a))
|
||||
{
|
||||
BOOST_ERROR("Rounded result was away from zero with boost::trunc");
|
||||
std::cerr << "Values were: " << std::setprecision(35) << std::setw(40)
|
||||
<< std::left << a << u << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
@@ -108,10 +120,12 @@ void check_modf_result(T a, T fract, U ipart)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_round(T, const char* /* name */)
|
||||
void test_round(T, const char* name )
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
std::cout << "Testing rounding with type " << name << std::endl;
|
||||
|
||||
for(int i = 0; i < 1000; ++i)
|
||||
{
|
||||
T arg = get_random<T>();
|
||||
@@ -223,7 +237,7 @@ int test_main(int, char* [])
|
||||
test_round(0.1, "double");
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_round(0.1L, "long double");
|
||||
//test_round(boost::math::concepts::real_concept(0.1), "real_concept");
|
||||
test_round(boost::math::concepts::real_concept(0.1), "real_concept");
|
||||
#else
|
||||
std::cout << "<note>The long double tests have been disabled on this platform "
|
||||
"either because the long double overloads of the usual math functions are "
|
||||
|
||||
Reference in New Issue
Block a user