|
Boost-Commit : |
From: john_at_[hidden]
Date: 2008-07-14 12:22:04
Author: johnmaddock
Date: 2008-07-14 12:22:03 EDT (Mon, 14 Jul 2008)
New Revision: 47421
URL: http://svn.boost.org/trac/boost/changeset/47421
Log:
Fix for std libs that don't have denorm support in numeric_limits.
Text files modified:
trunk/boost/math/special_functions/next.hpp | 2 +-
trunk/libs/math/test/test_next.cpp | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
Modified: trunk/boost/math/special_functions/next.hpp
==============================================================================
--- trunk/boost/math/special_functions/next.hpp (original)
+++ trunk/boost/math/special_functions/next.hpp 2008-07-14 12:22:03 EDT (Mon, 14 Jul 2008)
@@ -37,7 +37,7 @@
template <class T>
inline T get_smallest_value()
{
- return get_smallest_value<T>(mpl::bool_<std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::has_denorm>());
+ return get_smallest_value<T>(mpl::bool_<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::has_denorm == std::denorm_present)>());
}
}
Modified: trunk/libs/math/test/test_next.cpp
==============================================================================
--- trunk/libs/math/test/test_next.cpp (original)
+++ trunk/libs/math/test/test_next.cpp 2008-07-14 12:22:03 EDT (Mon, 14 Jul 2008)
@@ -39,8 +39,11 @@
BOOST_CHECK_EQUAL(float_distance(float_advance(val, 4), val), -4);
BOOST_CHECK_EQUAL(float_distance(float_advance(val, -4), val), 4);
- BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), 4), float_next(float_next(val))), -4);
- BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), -4), float_next(float_next(val))), 4);
+ if(std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::has_denorm == std::denorm_present))
+ {
+ BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), 4), float_next(float_next(val))), -4);
+ BOOST_CHECK_EQUAL(float_distance(float_advance(float_next(float_next(val)), -4), float_next(float_next(val))), 4);
+ }
}
template <class T>
@@ -60,7 +63,7 @@
test_value(-boost::math::tools::epsilon<T>(), name);
test_value(boost::math::tools::min_value<T>(), name);
test_value(-boost::math::tools::min_value<T>(), name);
- if(std::numeric_limits<T>::is_specialized)
+ if(std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::has_denorm == std::denorm_present))
{
test_value(z, name);
test_value(-z, name);
@@ -69,7 +72,7 @@
test_value(-one, name);
test_value(two, name);
test_value(-two, name);
- if(std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::has_denorm)
+ if(std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::has_denorm == std::denorm_present))
{
test_value(std::numeric_limits<T>::denorm_min(), name);
test_value(-std::numeric_limits<T>::denorm_min(), name);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk