From adb945b0742883f67d22753589e7fd738eff2bbe Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 6 Dec 2008 16:06:15 +0000 Subject: [PATCH] Fix Intel/Linux compile failures, and reinstate some old workarounds for broken std::fpclassify implementations. [SVN r50161] --- .../math/special_functions/fpclassify.hpp | 49 +++++++++++-------- include/boost/math/tools/config.hpp | 6 +++ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index c2a567a7b..f95ad6efb 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -224,29 +224,14 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) return FP_NAN; } -#if defined(BOOST_HAS_FPCLASSIFY) -template -inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, const U&) +#if defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) { - return BOOST_FPCLASSIFY_PREFIX fpclassify BOOST_NO_MACRO_EXPAND(x); -} -#if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \ - || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \ - || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99)) -// The native fpclassify broken for long doubles -// use portable one instead.... -template -inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const U&) -{ -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - typedef generic_tag::is_specialized> method; -#else - typedef generic_tag method; -#endif - return fpclassify_imp BOOST_NO_MACRO_EXPAND(t, method(), t); + return boost::math::detail::fpclassify_imp(t, generic_tag()); } #endif -#endif + } // namespace detail template @@ -299,6 +284,14 @@ namespace detail { return a != traits::exponent; } +#if defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isfinite_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isfinite_impl(t, generic_tag()); +} +#endif + } template @@ -348,6 +341,14 @@ namespace detail { return (a != 0) && (a < traits::exponent); } +#if defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isnormal_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isnormal_impl(t, generic_tag()); +} +#endif + } template @@ -414,6 +415,14 @@ namespace detail { return x == 0; } +#if defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isinf_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isinf_impl(t, generic_tag()); +} +#endif + } // namespace detail template diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index fe2de8923..44160ff83 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -82,6 +82,12 @@ # define BOOST_MATH_USE_C99 #endif +#if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \ + || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \ + || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99)) +# define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY +#endif + #if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) # include "boost/type.hpp"