Skip to content

Commit 74ff2db

Browse files
author
jzmaddock
committed
Change <quadmath.h> config to not use it at all if we don't have __has_include as GCC may be configured with --disable-libquadmath but still signal that it supports __float128
1 parent 587eb66 commit 74ff2db

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

include/boost/math/special_functions/fpclassify.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ is used.
8181
#include <float.h>
8282
#endif
8383
#ifdef BOOST_MATH_USE_FLOAT128
84+
#ifdef __has_include
85+
#if __has_include("quadmath.h")
8486
#include "quadmath.h"
87+
#define BOOST_MATH_HAS_QUADMATH_H
88+
#endif
89+
#endif
8590
#endif
8691

8792
#ifdef BOOST_NO_STDC_NAMESPACE
@@ -124,9 +129,14 @@ inline bool is_nan_helper(T, const boost::false_type&)
124129
{
125130
return false;
126131
}
127-
#ifdef BOOST_MATH_USE_FLOAT128
132+
#if defined(BOOST_MATH_USE_FLOAT128)
133+
#if defined(BOOST_MATH_HAS_QUADMATH_H)
128134
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); }
129135
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); }
136+
#else
137+
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast<double>(f)); }
138+
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast<double>(f)); }
139+
#endif
130140
#endif
131141
}
132142

@@ -519,7 +529,7 @@ inline bool (isinf)(long double x)
519529
return detail::isinf_impl(static_cast<value_type>(x), method());
520530
}
521531
#endif
522-
#ifdef BOOST_MATH_USE_FLOAT128
532+
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
523533
template<>
524534
inline bool (isinf)(__float128 x)
525535
{
@@ -611,7 +621,7 @@ inline bool (isnan)(long double x)
611621
return detail::isnan_impl(x, method());
612622
}
613623
#endif
614-
#ifdef BOOST_MATH_USE_FLOAT128
624+
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
615625
template<>
616626
inline bool (isnan)(__float128 x)
617627
{

include/boost/math/tools/config.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,6 @@
265265
# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
266266
#endif
267267
//
268-
// Test whether to support __float128, if we don't have quadmath.h then this can't currently work:
269-
//
270-
#ifndef BOOST_MATH_USE_FLOAT128
271-
#ifdef __has_include
272-
#if ! __has_include("quadmath.h")
273-
#define BOOST_MATH_DISABLE_FLOAT128
274-
#endif
275-
#elif !defined(BOOST_ARCH_X86)
276-
#define BOOST_MATH_DISABLE_FLOAT128
277-
#endif
278-
#endif
279-
//
280268
// And then the actual configuration:
281269
//
282270
#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \

0 commit comments

Comments
 (0)