Skip to content

Commit de345f6

Browse files
authored
Merge pull request #753 from boostorg/develop
Merge to Master for 1.91
2 parents 529dfac + 329ee7f commit de345f6

11 files changed

Lines changed: 114 additions & 44 deletions

File tree

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ can be found [here](https://www.youtube.com/watch?v=mK4WjpvLj4c).
4848
## Using Multiprecision
4949

5050
<p align="center">
51-
<a href="https://godbolt.org/z/hd95P3ovK" alt="godbolt">
51+
<a href="https://godbolt.org/z/cPeboe4Ge" alt="godbolt">
5252
<img src="https://img.shields.io/badge/try%20it%20on-godbolt-green" /></a>
5353
</p>
5454

@@ -62,7 +62,7 @@ where we also observe that Multiprecision can seamlesly interoperate with
6262

6363
```cpp
6464
// ------------------------------------------------------------------------------
65-
// Copyright Christopher Kormanyos 2024 - 2025.
65+
// Copyright Christopher Kormanyos 2024 - 2026.
6666
// Distributed under the Boost Software License,
6767
// Version 1.0. (See accompanying file LICENSE_1_0.txt
6868
// or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -107,6 +107,13 @@ auto main() -> int
107107
}
108108
```
109109

110+
The expected output is
111+
112+
```
113+
sqrt_pi : 1.772453850905516027298167483341145182797549456122387128213807789852911284591032181374950656738544665
114+
gamma_half: 1.772453850905516027298167483341145182797549456122387128213807789852911284591032181374950656738544666
115+
```
116+
110117
## Standalone
111118

112119
Defining `BOOST_MP_STANDALONE` allows `Boost.Multiprecision`

doc/tutorial_cpp_double_fp_backend.qbk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[section:cpp_double_fp_backend cpp_double_fp_backend]
1111

12-
`#include <boost/multiprecision/cpp_double_fp_backend.hpp>`
12+
`#include <boost/multiprecision/cpp_double_fp.hpp>`
1313

1414
namespace boost { namespace multiprecision {
1515

@@ -67,12 +67,12 @@ the `cpp_double_fp_backend` types.
6767
Things you should know when using the `cpp_double_fp_backend` types:
6868

6969
* Although the types are created from two individual IEEE floating-point components, they specifically and clearly are not IEEE types in their composite forms.
70-
* As a result these types can behave subtly differently from IEEE floating-point types.
70+
* As a result, these types can behave subtly differently from IEEE floating-point types.
7171
* The types can not be used with certain compiler variations of _fast_-_math_. On GCC/clang, for instance, `-ffast-math` can not be used (use either the default or explicitly set `-fno-fast-math`). On MSVC `/fp:fast` can not be used and `/fp:precise` (the default) is mandatory on MSVC compilers. This is because the algorithms, in particular those for addition, subtraction, multiplication, division and square root, rely on precise floating-point rounding.
7272
* The composite types are not as precise as their constituents. For information on error-bounds, see Joldes et al. in the references below.
7373
* There are `std::numeric_limits` specializations for these types.
7474
* Almost all of the methods of the `cpp_double_fp_backend` implementation are `constexpr`. The sole exception is read-from-string, which is not yet `constexpr`, but may become so in future evolution.
75-
* Conversions to and from string internally use an intermediate `cpp_bin_float` value. This is a bit awkward may be eliminated in future refinements.
75+
* Conversions to and from string internally use an intermediate `cpp_bin_float` value. This is a bit awkward and may be eliminated in future refinements.
7676

7777
The `cpp_double_fp_backend` back-end has been inspired by original works and types.
7878
These include the historical `doubledouble` and more, as listed below.

doc/tutorial_floats.qbk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The following back-ends provide floating-point arithmetic:
1616
[[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
1717
[[`cpp_bin_float<N>`][boost/multiprecision/cpp_bin_float.hpp][2][None][Header only, all C++ implementation. Boost licence.][Approximately 2x slower than the [mpfr] or [gmp] libraries.]]
1818
[[`cpp_dec_float<N>`][boost/multiprecision/cpp_dec_float.hpp][10][None][Header only, all C++ implementation. Boost licence.][Approximately 2x slower than the [mpfr] or [gmp] libraries.]]
19-
[[`mpf_float<N>`][boost/multiprecision/gmp.hpp][2][[gmp]][Very fast and efficient back-end.][Dependency on GNU licensed [gmp] library.]]
20-
[[`mpfr_float<N>`][boost/multiprecision/mpfr.hpp][2][[gmp] and [mpfr]][Very fast and efficient back-end, with its own standard library implementation.][Dependency on GNU licensed [gmp] and [mpfr] libraries.]]
21-
[[`float128`][boost/multiprecision/float128.hpp][2][Either [quadmath] or the Intel C++ Math library.][Very fast and efficient back-end for 128-bit floating-point values (113-bit mantissa, equivalent to FORTRAN's QUAD real)][Depends on the compiler being either recent GCC or Intel C++ versions.]]
22-
[[`cpp_double_fp_backend<T>`][boost/multiprecision/cpp_double_fp_backend.hpp][2][None][Header only, all C++ implementation. Boost licence.][Approximately 2x double-`float`, `double`, `long double` or `boost::float128_type` designed for lower-precision, higher run-time performance.]]
19+
[[`gmp_float<N>`][boost/multiprecision/gmp.hpp][2][[gmp]][Very fast and efficient back-end.][Dependency on GNU licensed [gmp] library.]]
20+
[[`mpfr_float_backend<N>`][boost/multiprecision/mpfr.hpp][2][[gmp] and [mpfr]][Very fast and efficient back-end, with its own standard library implementation.][Dependency on GNU licensed [gmp] and [mpfr] libraries.]]
21+
[[`float128_backend`][boost/multiprecision/float128.hpp][2][Either [quadmath] or the Intel C++ Math library.][Very fast and efficient back-end for 128-bit floating-point values (113-bit mantissa, equivalent to FORTRAN's QUAD real)][Depends on the compiler being either recent GCC or Intel C++ versions.]]
22+
[[`cpp_double_fp_backend<T>`][boost/multiprecision/cpp_double_fp.hpp][2][None][Header only, all C++ implementation. Boost licence.][Approximately 2x double-`float`, `double`, `long double` or `boost::float128_type` designed for lower-precision, higher run-time performance.]]
2323
]
2424

2525
[include tutorial_cpp_bin_float.qbk]

include/boost/multiprecision/cpp_bin_float.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,12 +2273,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bi
22732273
static constexpr bool has_quiet_NaN = true;
22742274
static constexpr bool has_signaling_NaN = false;
22752275
#ifdef _MSC_VER
2276-
#pragma warning(push)
2277-
#pragma warning(disable:4996)
2276+
# pragma warning(push)
2277+
# pragma warning(disable : 4996)
2278+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2279+
# pragma clang diagnostic push
2280+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
22782281
#endif
22792282
static constexpr float_denorm_style has_denorm = denorm_absent;
22802283
#ifdef _MSC_VER
22812284
#pragma warning(pop)
2285+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2286+
# pragma clang diagnostic pop
22822287
#endif
22832288
static constexpr bool has_denorm_loss = false;
22842289
static number_type infinity()

include/boost/multiprecision/cpp_dec_float.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,17 +3681,22 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_de
36813681
static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type max_exponent = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp; // Type differs from int.
36823682
static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type max_exponent10 = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10; // Type differs from int.
36833683
static constexpr int radix = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
3684-
static constexpr std::float_round_style round_style = std::round_indeterminate;
3684+
static constexpr float_round_style round_style = round_indeterminate;
36853685
static constexpr bool has_infinity = true;
36863686
static constexpr bool has_quiet_NaN = true;
36873687
static constexpr bool has_signaling_NaN = false;
36883688
#ifdef _MSC_VER
3689-
#pragma warning(push)
3690-
#pragma warning(disable : 4996)
3689+
# pragma warning(push)
3690+
# pragma warning(disable : 4996)
3691+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3692+
# pragma clang diagnostic push
3693+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
36913694
#endif
3692-
static constexpr std::float_denorm_style has_denorm = std::denorm_absent;
3695+
static constexpr float_denorm_style has_denorm = denorm_absent;
36933696
#ifdef _MSC_VER
36943697
#pragma warning(pop)
3698+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3699+
# pragma clang diagnostic pop
36953700
#endif
36963701
static constexpr bool has_denorm_loss = false;
36973702
static constexpr bool traps = false;

include/boost/multiprecision/cpp_double_fp.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,19 @@ BOOST_MP_DF_QF_NUM_LIMITS_CLASS_TYPE numeric_limits<boost::multiprecision::numbe
25552555
#pragma warning(disable:4996)
25562556
#endif
25572557

2558+
#ifdef _MSC_VER
2559+
# pragma warning(push)
2560+
# pragma warning(disable : 4996)
2561+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2562+
# pragma clang diagnostic push
2563+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
2564+
#endif
25582565
static constexpr float_denorm_style has_denorm = denorm_absent;
2566+
#ifdef _MSC_VER
2567+
#pragma warning(pop)
2568+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2569+
# pragma clang diagnostic pop
2570+
#endif
25592571
static constexpr bool has_denorm_loss = true;
25602572

25612573
#ifdef BOOST_MSVC

include/boost/multiprecision/cpp_int/limits.hpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,18 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_in
200200
static constexpr bool has_infinity = false;
201201
static constexpr bool has_quiet_NaN = false;
202202
static constexpr bool has_signaling_NaN = false;
203-
#if defined(__clang__) && defined(__has_warning)
204-
# if __has_warning("-Wdeprecated-declarations")
203+
#ifdef _MSC_VER
204+
# pragma warning(push)
205+
# pragma warning(disable : 4996)
206+
#elif (defined(__clang__) && (__clang_major__ >= 17))
205207
# pragma clang diagnostic push
206208
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
207-
# endif
208-
#elif defined(_MSC_VER)
209-
# pragma warning(push)
210-
# pragma warning(disable:4996)
211209
#endif
212210
static constexpr float_denorm_style has_denorm = denorm_absent;
213-
#if defined(__clang__) && defined(__has_warning)
214-
# if __has_warning("-Wdeprecated-declarations")
211+
#ifdef _MSC_VER
212+
#pragma warning(pop)
213+
#elif (defined(__clang__) && (__clang_major__ >= 17))
215214
# pragma clang diagnostic pop
216-
# endif
217-
#elif defined(_MSC_VER)
218-
# pragma warning(pop)
219215
#endif
220216
static constexpr bool has_denorm_loss = false;
221217
static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type infinity() { return 0; }

include/boost/multiprecision/gmp.hpp

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,12 +3591,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::gmp_fl
35913591
static constexpr bool has_quiet_NaN = false;
35923592
static constexpr bool has_signaling_NaN = false;
35933593
#ifdef _MSC_VER
3594-
#pragma warning(push)
3595-
#pragma warning(disable : 4996)
3594+
# pragma warning(push)
3595+
# pragma warning(disable : 4996)
3596+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3597+
# pragma clang diagnostic push
3598+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
35963599
#endif
35973600
static constexpr float_denorm_style has_denorm = denorm_absent;
35983601
#ifdef _MSC_VER
35993602
#pragma warning(pop)
3603+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3604+
# pragma clang diagnostic pop
36003605
#endif
36013606
static constexpr bool has_denorm_loss = false;
36023607
static constexpr number_type infinity() { return number_type(); }
@@ -3690,12 +3695,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::gmp_fl
36903695
static constexpr bool has_quiet_NaN = false;
36913696
static constexpr bool has_signaling_NaN = false;
36923697
#ifdef _MSC_VER
3693-
#pragma warning(push)
3694-
#pragma warning(disable : 4996)
3698+
# pragma warning(push)
3699+
# pragma warning(disable : 4996)
3700+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3701+
# pragma clang diagnostic push
3702+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
36953703
#endif
36963704
static constexpr float_denorm_style has_denorm = denorm_absent;
36973705
#ifdef _MSC_VER
36983706
#pragma warning(pop)
3707+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3708+
# pragma clang diagnostic pop
36993709
#endif
37003710
static constexpr bool has_denorm_loss = false;
37013711
static number_type infinity() { return number_type(); }
@@ -3799,12 +3809,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::gmp_in
37993809
static constexpr bool has_quiet_NaN = false;
38003810
static constexpr bool has_signaling_NaN = false;
38013811
#ifdef _MSC_VER
3802-
#pragma warning(push)
3803-
#pragma warning(disable : 4996)
3812+
# pragma warning(push)
3813+
# pragma warning(disable : 4996)
3814+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3815+
# pragma clang diagnostic push
3816+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
38043817
#endif
38053818
static constexpr float_denorm_style has_denorm = denorm_absent;
38063819
#ifdef _MSC_VER
38073820
#pragma warning(pop)
3821+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3822+
# pragma clang diagnostic pop
38083823
#endif
38093824
static constexpr bool has_denorm_loss = false;
38103825
static number_type infinity() { return number_type(); }
@@ -3909,12 +3924,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::gmp_ra
39093924
static constexpr bool has_quiet_NaN = false;
39103925
static constexpr bool has_signaling_NaN = false;
39113926
#ifdef _MSC_VER
3912-
#pragma warning(push)
3913-
#pragma warning(disable : 4996)
3927+
# pragma warning(push)
3928+
# pragma warning(disable : 4996)
3929+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3930+
# pragma clang diagnostic push
3931+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
39143932
#endif
39153933
static constexpr float_denorm_style has_denorm = denorm_absent;
39163934
#ifdef _MSC_VER
39173935
#pragma warning(pop)
3936+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3937+
# pragma clang diagnostic pop
39183938
#endif
39193939
static constexpr bool has_denorm_loss = false;
39203940
static number_type infinity() { return number_type(); }

include/boost/multiprecision/mpfi.hpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,12 +2373,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_f
23732373
static constexpr bool has_quiet_NaN = true;
23742374
static constexpr bool has_signaling_NaN = false;
23752375
#ifdef _MSC_VER
2376-
#pragma warning(push)
2377-
#pragma warning(disable : 4996)
2376+
# pragma warning(push)
2377+
# pragma warning(disable : 4996)
2378+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2379+
# pragma clang diagnostic push
2380+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
23782381
#endif
23792382
static constexpr float_denorm_style has_denorm = denorm_absent;
23802383
#ifdef _MSC_VER
23812384
#pragma warning(pop)
2385+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2386+
# pragma clang diagnostic pop
23822387
#endif
23832388
static constexpr bool has_denorm_loss = false;
23842389
static number_type infinity()
@@ -2483,12 +2488,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfi_f
24832488
static constexpr bool has_quiet_NaN = false;
24842489
static constexpr bool has_signaling_NaN = false;
24852490
#ifdef _MSC_VER
2486-
#pragma warning(push)
2487-
#pragma warning(disable : 4996)
2491+
# pragma warning(push)
2492+
# pragma warning(disable : 4996)
2493+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2494+
# pragma clang diagnostic push
2495+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
24882496
#endif
24892497
static constexpr float_denorm_style has_denorm = denorm_absent;
24902498
#ifdef _MSC_VER
24912499
#pragma warning(pop)
2500+
#elif (defined(__clang__) && (__clang_major__ >= 17))
2501+
# pragma clang diagnostic pop
24922502
#endif
24932503
static constexpr bool has_denorm_loss = false;
24942504
static number_type infinity() { return number_type(0); }

include/boost/multiprecision/mpfr.hpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,12 +3429,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_f
34293429
static constexpr bool has_quiet_NaN = true;
34303430
static constexpr bool has_signaling_NaN = false;
34313431
#ifdef _MSC_VER
3432-
#pragma warning(push)
3433-
#pragma warning(disable : 4996)
3432+
# pragma warning(push)
3433+
# pragma warning(disable : 4996)
3434+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3435+
# pragma clang diagnostic push
3436+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
34343437
#endif
34353438
static constexpr float_denorm_style has_denorm = denorm_absent;
34363439
#ifdef _MSC_VER
34373440
#pragma warning(pop)
3441+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3442+
# pragma clang diagnostic pop
34383443
#endif
34393444
static constexpr bool has_denorm_loss = false;
34403445
static number_type infinity()
@@ -3562,12 +3567,17 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_f
35623567
static constexpr bool has_quiet_NaN = true;
35633568
static constexpr bool has_signaling_NaN = false;
35643569
#ifdef _MSC_VER
3565-
#pragma warning(push)
3566-
#pragma warning(disable : 4996)
3570+
# pragma warning(push)
3571+
# pragma warning(disable : 4996)
3572+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3573+
# pragma clang diagnostic push
3574+
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
35673575
#endif
35683576
static constexpr float_denorm_style has_denorm = denorm_absent;
35693577
#ifdef _MSC_VER
35703578
#pragma warning(pop)
3579+
#elif (defined(__clang__) && (__clang_major__ >= 17))
3580+
# pragma clang diagnostic pop
35713581
#endif
35723582
static constexpr bool has_denorm_loss = false;
35733583
static number_type infinity()

0 commit comments

Comments
 (0)