mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Fix Intel/Linux regressions.
[SVN r71420]
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -80,6 +81,9 @@ void basic_test_finite()
|
||||
|
||||
template<class CharType, class ValType> void basic_test_finite_impl()
|
||||
{
|
||||
if((std::numeric_limits<ValType>::has_infinity == 0) || (std::numeric_limits<ValType>::infinity() == 0))
|
||||
return;
|
||||
|
||||
std::locale old_locale;
|
||||
std::locale tmp_locale(old_locale, new nonfinite_num_put<CharType>);
|
||||
std::locale new_locale(tmp_locale, new nonfinite_num_get<CharType>);
|
||||
@@ -129,6 +133,9 @@ void basic_test_inf()
|
||||
|
||||
template<class CharType, class ValType> void basic_test_inf_impl()
|
||||
{
|
||||
if((std::numeric_limits<ValType>::has_infinity == 0) || (std::numeric_limits<ValType>::infinity() == 0))
|
||||
return;
|
||||
|
||||
std::locale old_locale;
|
||||
std::locale tmp_locale(old_locale, new nonfinite_num_put<CharType>);
|
||||
std::locale new_locale(tmp_locale, new nonfinite_num_get<CharType>);
|
||||
@@ -139,6 +146,9 @@ template<class CharType, class ValType> void basic_test_inf_impl()
|
||||
ValType a1 = std::numeric_limits<ValType>::infinity();
|
||||
ValType a2 = -std::numeric_limits<ValType>::infinity();
|
||||
|
||||
BOOST_CHECK((boost::math::isinf)(a1));
|
||||
BOOST_CHECK((boost::math::isinf)(a2));
|
||||
|
||||
ss << a1 << ' ' << a2;
|
||||
|
||||
std::basic_string<CharType> s = S_("inf -inf");
|
||||
@@ -173,6 +183,9 @@ void basic_test_nan()
|
||||
|
||||
template<class CharType, class ValType> void basic_test_nan_impl()
|
||||
{
|
||||
if((std::numeric_limits<ValType>::has_quiet_NaN == 0) || (std::numeric_limits<ValType>::quiet_NaN() == 0))
|
||||
return;
|
||||
|
||||
std::locale old_locale;
|
||||
std::locale tmp_locale(old_locale, new nonfinite_num_put<CharType>);
|
||||
std::locale new_locale(tmp_locale, new nonfinite_num_get<CharType>);
|
||||
@@ -181,11 +194,13 @@ template<class CharType, class ValType> void basic_test_nan_impl()
|
||||
ss.imbue(new_locale);
|
||||
|
||||
ValType a1 = std::numeric_limits<ValType>::quiet_NaN();
|
||||
ValType a2 = -std::numeric_limits<ValType>::quiet_NaN();
|
||||
ValType a2 = (boost::math::changesign)(std::numeric_limits<ValType>::quiet_NaN());
|
||||
ValType a3 = std::numeric_limits<ValType>::signaling_NaN();
|
||||
ValType a4 = -std::numeric_limits<ValType>::signaling_NaN();
|
||||
ValType a4 = (boost::math::changesign)(std::numeric_limits<ValType>::signaling_NaN());
|
||||
ss << a1 << ' ' << a2 << ' ' << a3 << ' ' << a4;
|
||||
|
||||
BOOST_CHECK((boost::math::isnan)(a1) && (boost::math::isnan)(a2) && (boost::math::isnan)(a3) && (boost::math::isnan)(a4));
|
||||
|
||||
std::basic_string<CharType> s = S_("nan -nan nan -nan");
|
||||
BOOST_CHECK(ss.str() == s);
|
||||
|
||||
@@ -226,6 +241,9 @@ void basic_test_format()
|
||||
|
||||
template<class CharType, class ValType> void basic_test_format_impl()
|
||||
{
|
||||
if((std::numeric_limits<ValType>::has_infinity == 0) || (std::numeric_limits<ValType>::infinity() == 0))
|
||||
return;
|
||||
|
||||
std::locale old_locale;
|
||||
std::locale tmp_locale(old_locale, new nonfinite_num_put<CharType>);
|
||||
std::locale new_locale(tmp_locale, new nonfinite_num_get<CharType>);
|
||||
@@ -235,6 +253,8 @@ template<class CharType, class ValType> void basic_test_format_impl()
|
||||
|
||||
ValType a = std::numeric_limits<ValType>::infinity();
|
||||
|
||||
BOOST_CHECK((boost::math::isinf)(a));
|
||||
|
||||
ss << std::setw(6) << a; // Expect right justified in field of six, so 3 leading spaces.
|
||||
ss << '|';
|
||||
ss << std::setw(2) << a; // Too narrow for "inf", but should still be "inf".
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// Copyright (c) 2006 Johan Rade
|
||||
|
||||
// Copyright (c) 2011 Paul A. Bristow incorporated Boost.Math
|
||||
@@ -52,6 +53,11 @@ BOOST_AUTO_TEST_CASE(lexical_cast_test)
|
||||
|
||||
template<class CharType, class ValType> void lexical_cast_test_impl()
|
||||
{
|
||||
if((std::numeric_limits<ValType>::has_infinity == 0) || (std::numeric_limits<ValType>::infinity() == 0))
|
||||
return;
|
||||
if((std::numeric_limits<ValType>::has_quiet_NaN == 0) || (std::numeric_limits<ValType>::quiet_NaN() == 0))
|
||||
return;
|
||||
|
||||
std::locale old_locale;
|
||||
std::locale tmp_locale(old_locale,
|
||||
new nonfinite_num_put<CharType>(signed_zero));
|
||||
@@ -66,8 +72,8 @@ template<class CharType, class ValType> void lexical_cast_test_impl()
|
||||
ValType a6 = (changesign)(static_cast<ValType>(0));
|
||||
ValType a7 = static_cast<ValType>(-57);
|
||||
ValType a8 = -std::numeric_limits<ValType>::infinity();
|
||||
ValType a9 = -std::numeric_limits<ValType>::quiet_NaN();
|
||||
ValType a10 = -std::numeric_limits<ValType>::signaling_NaN();
|
||||
ValType a9 = (changesign)(std::numeric_limits<ValType>::quiet_NaN());
|
||||
ValType a10 = (changesign)(std::numeric_limits<ValType>::signaling_NaN());
|
||||
|
||||
std::basic_string<CharType> s1 = S_("0");
|
||||
std::basic_string<CharType> s2 = S_("13");
|
||||
|
||||
Reference in New Issue
Block a user