Skip to content

Commit c9dede1

Browse files
authored
Merge pull request #173 from BoostGSoC21/elem_func_gnu128
Fix #173 via ensure everything works in gnu++XX
2 parents 7cc9985 + ca4f0a2 commit c9dede1

File tree

8 files changed

+214
-172
lines changed

8 files changed

+214
-172
lines changed

.github/workflows/multiprecision.yml

+59
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,65 @@ jobs:
143143
- name: b2 config
144144
run: cat bin.v2/config.log
145145
working-directory: ../boost-root/
146+
ubuntu-jammy-gnu-df:
147+
runs-on: ubuntu-22.04
148+
defaults:
149+
run:
150+
shell: bash
151+
strategy:
152+
fail-fast: false
153+
matrix:
154+
compiler: [ g++ ]
155+
suite: [ functions_df_gnu ]
156+
steps:
157+
- uses: actions/checkout@v4
158+
with:
159+
fetch-depth: '0'
160+
- name: Set TOOLSET
161+
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
162+
- name: Add repository
163+
continue-on-error: true
164+
id: addrepo
165+
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
166+
- name: Retry Add Repo
167+
continue-on-error: true
168+
id: retry1
169+
if: steps.addrepo.outcome=='failure'
170+
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
171+
- name: Retry Add Repo 2
172+
continue-on-error: true
173+
id: retry2
174+
if: steps.retry1.outcome=='failure'
175+
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
176+
- name: Checkout main boost
177+
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
178+
- name: Update tools/boostdep
179+
run: git submodule update --init tools/boostdep
180+
working-directory: ../boost-root
181+
- name: Copy files
182+
run: cp -r $GITHUB_WORKSPACE/* libs/multiprecision
183+
working-directory: ../boost-root
184+
- name: Install deps
185+
run: python tools/boostdep/depinst/depinst.py multiprecision
186+
working-directory: ../boost-root
187+
- name: Bootstrap
188+
run: ./bootstrap.sh
189+
working-directory: ../boost-root
190+
- name: Generate headers
191+
run: ./b2 headers
192+
working-directory: ../boost-root
193+
- name: Generate user config
194+
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=gnu++14 ;" > ~/user-config.jam'
195+
working-directory: ../boost-root
196+
- name: Config Info
197+
run: ../../../b2 print_config_info print_math_info toolset=$TOOLSET
198+
working-directory: ../boost-root/libs/config/test
199+
- name: Test
200+
run: ../../../b2 -j2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=BOOST_MP_SF_CONCEPT_TESTS
201+
working-directory: ../boost-root/libs/multiprecision/test
202+
- name: b2 config
203+
run: cat bin.v2/config.log
204+
working-directory: ../boost-root/
146205
ubuntu-focal:
147206
runs-on: ubuntu-20.04
148207
defaults:

include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail.hpp

+19-15
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@
1212

1313
#include <boost/config.hpp>
1414

15-
#ifdef BOOST_HAS_FLOAT128
16-
# if __has_include(<quadmath.h>)
17-
# include <quadmath.h>
18-
# ifndef BOOST_MP_HAS_FLOAT128_SUPPORT
19-
# define BOOST_MP_HAS_FLOAT128_SUPPORT
20-
# endif
21-
# endif
15+
#if defined(BOOST_HAS_FLOAT128)
16+
#if defined(__has_include)
17+
#if __has_include(<quadmath.h>)
18+
19+
#include <quadmath.h>
20+
21+
#if !defined(BOOST_MP_CPP_DOUBLE_FP_HAS_FLOAT128)
22+
#define BOOST_MP_CPP_DOUBLE_FP_HAS_FLOAT128
2223
#endif
2324

25+
#endif // __has_include(<quadmath.h>)
26+
#endif // defined(__has_include)
27+
#endif // defined(BOOST_HAS_FLOAT128)
28+
2429
#include <boost/multiprecision/number.hpp>
2530
#include <boost/multiprecision/detail/float128_functions.hpp>
2631
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath.hpp>
@@ -30,13 +35,13 @@
3035
namespace boost { namespace multiprecision { namespace backends { namespace cpp_df_qf_detail {
3136

3237
template <class FloatingPointType>
33-
struct is_floating_point_or_float128
38+
struct is_floating_point
3439
{
35-
static constexpr auto value = std::is_same<FloatingPointType, float>::value
36-
|| std::is_same<FloatingPointType, double>::value
37-
|| std::is_same<FloatingPointType, long double>::value
38-
#if defined(BOOST_HAS_FLOAT128)
39-
|| std::is_same<FloatingPointType, ::boost::float128_type>::value
40+
static constexpr auto value = ::std::is_same<FloatingPointType, float>::value
41+
|| ::std::is_same<FloatingPointType, double>::value
42+
|| ::std::is_same<FloatingPointType, long double>::value
43+
#if defined(BOOST_MP_CPP_DOUBLE_FP_HAS_FLOAT128)
44+
|| ::std::is_same<FloatingPointType, ::boost::float128_type>::value
4045
#endif
4146
;
4247
};
@@ -77,8 +82,7 @@ struct exact_arithmetic
7782
// The exact_arithmetic<> struct implements extended precision
7883
// techniques that are used in cpp_double_fp_backend and cpp_quad_float.
7984

80-
static_assert(is_floating_point_or_float128<FloatingPointType>::value,
81-
"Error: exact_arithmetic<> invoked with unknown floating-point type");
85+
static_assert(is_floating_point<FloatingPointType>::value, "Error: exact_arithmetic<> invoked with unknown floating-point type");
8286

8387
using float_type = FloatingPointType;
8488
using float_pair = std::pair<float_type, float_type>;

include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_limits.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct numeric_limits<FloatingPointType,
2727
typename std::enable_if<( std::is_same<FloatingPointType, float>::value
2828
|| std::is_same<FloatingPointType, double>::value
2929
|| std::is_same<FloatingPointType, long double>::value
30-
#if defined(BOOST_HAS_FLOAT128)
30+
#if defined(BOOST_MP_CPP_DOUBLE_FP_HAS_FLOAT128)
3131
|| std::is_same<FloatingPointType, ::boost::float128_type>::value
3232
#endif
3333
)>::type>

0 commit comments

Comments
 (0)