|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79439 - in trunk/boost/math: special_functions/detail tools
From: john_at_[hidden]
Date: 2012-07-12 05:53:18
Author: johnmaddock
Date: 2012-07-12 05:53:18 EDT (Thu, 12 Jul 2012)
New Revision: 79439
URL: http://svn.boost.org/trac/boost/changeset/79439
Log:
Tentative fix #2 for TI compiler error.
Refs #7099.
Text files modified:
trunk/boost/math/special_functions/detail/erf_inv.hpp | 38 +++++++++++++-------------------------
trunk/boost/math/tools/big_constant.hpp | 2 +-
2 files changed, 14 insertions(+), 26 deletions(-)
Modified: trunk/boost/math/special_functions/detail/erf_inv.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/erf_inv.hpp (original)
+++ trunk/boost/math/special_functions/detail/erf_inv.hpp 2012-07-12 05:53:18 EDT (Thu, 12 Jul 2012)
@@ -331,28 +331,6 @@
{
do_init();
}
- template <class Tag>
- static void do_init_big(const Tag&)
- {
- // Make this a template so it's not instantiated if these constants are too large
- // for the compiler to handle. See https://svn.boost.org/trac/boost/ticket/7099
- if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)) != 0)
- boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy());
- if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)) != 0)
- boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy());
- }
- static void do_init_big(const mpl::false_&)
- {
- // Initialization here is pointless for (built in) floating point types,
- // but may still be required for UDT's:
- if(!is_floating_point<T>::value)
- {
- if(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-800)) != 0)
- boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy());
- if(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-900)) != 0)
- boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy());
- }
- }
static void do_init()
{
boost::math::erf_inv(static_cast<T>(0.25), Policy());
@@ -362,9 +340,19 @@
if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)) != 0)
boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)), Policy());
- typedef mpl::bool_<(LDBL_MIN_EXP < -1030)> tag_type;
-
- do_init_big(tag_type());
+ // Some compilers choke on constants that would underflow, even in code that isn't instantiated
+ // so try and filter these cases out in the preprocessor:
+#if LDBL_MAX_10_EXP >= 800
+ if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy());
+ if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy());
+#else
+ if(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-800)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-800)), Policy());
+ if(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-900)) != 0)
+ boost::math::erfc_inv(static_cast<T>(BOOST_MATH_HUGE_CONSTANT(T, 64, 1e-900)), Policy());
+#endif
}
void force_instantiate()const{}
};
Modified: trunk/boost/math/tools/big_constant.hpp
==============================================================================
--- trunk/boost/math/tools/big_constant.hpp (original)
+++ trunk/boost/math/tools/big_constant.hpp 2012-07-12 05:53:18 EDT (Thu, 12 Jul 2012)
@@ -53,7 +53,7 @@
// For constants too huge for any conceivable long double (and which generate compiler errors if we try and declare them as such):
//
#define BOOST_MATH_HUGE_CONSTANT(T, D, x)\
- boost::math::tools::make_big_value<T>(0.0L, BOOST_STRINGIZE(x), mpl::bool_<false>(), boost::is_convertible<const char*, T>())
+ boost::math::tools::make_big_value<T>(0.0L, BOOST_STRINGIZE(x), is_floating_point<T>(), boost::is_convertible<const char*, T>())
}}} // namespaces
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