Skip to content

Commit

Permalink
Change <quadmath.h> config to not use it at all if we don't have __ha…
Browse files Browse the repository at this point in the history
…s_include as GCC may be configured with --disable-libquadmath but still signal that it supports __float128
  • Loading branch information
jzmaddock committed Jan 1, 2016
1 parent 587eb66 commit 74ff2db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
16 changes: 13 additions & 3 deletions include/boost/math/special_functions/fpclassify.hpp
Expand Up @@ -81,7 +81,12 @@ is used.
#include <float.h>
#endif
#ifdef BOOST_MATH_USE_FLOAT128
#ifdef __has_include
#if __has_include("quadmath.h")
#include "quadmath.h"
#define BOOST_MATH_HAS_QUADMATH_H
#endif
#endif
#endif

#ifdef BOOST_NO_STDC_NAMESPACE
Expand Down Expand Up @@ -124,9 +129,14 @@ inline bool is_nan_helper(T, const boost::false_type&)
{
return false;
}
#ifdef BOOST_MATH_USE_FLOAT128
#if defined(BOOST_MATH_USE_FLOAT128)
#if defined(BOOST_MATH_HAS_QUADMATH_H)
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); }
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); }
#else
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast<double>(f)); }
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast<double>(f)); }
#endif
#endif
}

Expand Down Expand Up @@ -519,7 +529,7 @@ inline bool (isinf)(long double x)
return detail::isinf_impl(static_cast<value_type>(x), method());
}
#endif
#ifdef BOOST_MATH_USE_FLOAT128
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
template<>
inline bool (isinf)(__float128 x)
{
Expand Down Expand Up @@ -611,7 +621,7 @@ inline bool (isnan)(long double x)
return detail::isnan_impl(x, method());
}
#endif
#ifdef BOOST_MATH_USE_FLOAT128
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
template<>
inline bool (isnan)(__float128 x)
{
Expand Down
12 changes: 0 additions & 12 deletions include/boost/math/tools/config.hpp
Expand Up @@ -265,18 +265,6 @@
# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
#endif
//
// Test whether to support __float128, if we don't have quadmath.h then this can't currently work:
//
#ifndef BOOST_MATH_USE_FLOAT128
#ifdef __has_include
#if ! __has_include("quadmath.h")
#define BOOST_MATH_DISABLE_FLOAT128
#endif
#elif !defined(BOOST_ARCH_X86)
#define BOOST_MATH_DISABLE_FLOAT128
#endif
#endif
//
// And then the actual configuration:
//
#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \
Expand Down

0 comments on commit 74ff2db

Please sign in to comment.