summaryrefslogtreecommitdiff
path: root/external/boost/boost_1_60_0.quadmath.patch
blob: 344de9a67102ec63d39e8def2d0b7a8bf55588ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 74ff2db959c5fa75bec770c41ed2951a740fe936 Mon Sep 17 00:00:00 2001
From: jzmaddock <jz.maddock@gmail.com>
Date: Fri, 1 Jan 2016 16:49:48 +0000
Subject: [PATCH] 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

---
 include/boost/math/special_functions/fpclassify.hpp | 16 +++++++++++++---
 include/boost/math/tools/config.hpp                 | 12 ------------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp
index 0a4e1ac..58fad13 100644
--- foo/bar/include/boost/math/special_functions/fpclassify.hpp
+++ foo/bar/include/boost/math/special_functions/fpclassify.hpp
@@ -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
@@ -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
 }
 
@@ -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)
 {
@@ -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)
 {
diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp
index ffd0ab4..75d29b6 100644
--- foo/bar/include/boost/math/tools/config.hpp
+++ foo/bar/include/boost/math/tools/config.hpp
@@ -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__) \