From 0d73ce094afad1eab13b675837a9718d5362153b Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Wed, 3 Jul 2024 21:43:42 +0200 Subject: [PATCH 1/6] Update docs --- README.md | 91 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index dbc29eac1..0cb81959e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Boost Multiprecision Library ============================ ->ANNOUNCEMENT: This library requires a compliant C++14 compiler. - | | Master | Develop | |------------------|----------|-------------| | Drone | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/multiprecision) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg)](https://drone.cpp.al/boostorg/multiprecision) | @@ -10,27 +8,35 @@ Boost Multiprecision Library | Codecov | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/master) | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/develop) | -The Multiprecision Library provides integer, rational, floating-point, complex and interval number types in C++ that have more range and -precision than C++'s ordinary built-in types. The big number types in Multiprecision can be used with a wide selection of basic -mathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can -also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows Boost.Multiprecision to be +The `Boost.Multiprecision` Library provides integer, rational, floating-point, complex and interval number types in C++ that have more range and +precision than C++'s ordinary built-in types. + +Language adherence: + - `Boost.Multiprecision` requires a compliant C++14 compiler. + - It is compatible with C++14, 17, 20, 23 and beyond. + +The big number types in `Boost.Multiprecision` can be used with a wide selection of basic +mathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can +also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows Boost.Multiprecision to be used for all kinds of mathematical calculations involving integer, rational and floating-point types requiring extended range and precision. -Multiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with -support for integer, rational and floating-point types. Boost.Multiprecision provides a selection of back ends provided off-the-rack in -including interfaces to GMP, MPFR, MPIR, TomMath as well as its own collection of Boost-licensed, header-only back ends for integers, -rationals, floats and complex. In addition, user-defined back ends can be created and used with the interface of Multiprecision, provided the class implementation adheres to the necessary concepts. +Multiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with +support for integer, rational and floating-point types. `Boost.Multiprecision` provides a selection of back ends provided off-the-rack in +including interfaces to GMP, MPFR, MPIR, TomMath as well as its own collection of Boost-licensed, header-only back ends for integers, +rationals, floats and complex. In addition, user-defined back ends can be created and used with the interface of Multiprecision, +provided the class implementation adheres to the necessary concepts. -Depending upon the number type, precision may be arbitrarily large (limited only by available memory), fixed at compile time -(for example 50 or 100 decimal digits), or a variable controlled at run-time by member functions. The types are expression-template-enabled -for better performance than naive user-defined types. +Depending upon the number type, precision may be arbitrarily large (limited only by available memory), fixed at compile time +(for example $50$ or $100$ decimal digits), or a variable controlled at run-time by member functions. +The types are expression-template-enabled by default. This usually provides better performance than naive user-defined types. +If not needed, expression templates can be disabled when configuring the `number` type with its backend. The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/multiprecision/index.html). ## Using Multiprecision ##

- +

@@ -42,9 +48,10 @@ $$\sqrt{\pi} = \Gamma \left( \frac{1}{2} \right)~{\approx}~1.7724538509055160272 where we also observe that Multiprecision can seemlesly interoperate with [Boost.Math](https://github.com/boostorg/math). -``` +```cpp #include #include +#include #include #include @@ -55,20 +62,30 @@ auto main() -> int const big_float_type sqrt_pi { sqrt(boost::math::constants::pi()) }; - const big_float_type one_half { big_float_type(1) / 2 }; + const big_float_type half { big_float_type(1) / 2 }; + + const big_float_type gamma_half { boost::math::tgamma(half) }; + + std::stringstream strm { }; - const big_float_type gamma_half { boost::math::tgamma(one_half) }; + strm << std::setprecision(std::numeric_limits::digits10) << "sqrt_pi : " << sqrt_pi << '\n'; + strm << std::setprecision(std::numeric_limits::digits10) << "gamma_half: " << gamma_half; - std::cout << std::setprecision(std::numeric_limits::digits10) << "sqrt_pi : " << sqrt_pi << std::endl; - std::cout << std::setprecision(std::numeric_limits::digits10) << "gamma_half: " << gamma_half << std::endl; + std::cout << strm.str() << std::endl; } ``` ## Standalone ## -Defining BOOST_MP_STANDALONE allows Boost.Multiprecision to be used with the only dependency being [Boost.Config](https://github.com/boostorg/config). Our [package on this page](https://github.com/boostorg/multiprecision/releases) -already includes a copy of Boost.Config so no other downloads are required. Some functionality is reduced in this mode. A static_assert message will alert you if a particular feature has been disabled by standalone mode. -[Boost.Math](https://github.com/boostorg/math) standalone mode is compatiable, and recommended if special functions are required for the floating point types. +Defining `BOOST_MP_STANDALONE` allows `Boost.Multiprecision` +to be used with the only dependency being [Boost.Config](https://github.com/boostorg/config). + +Our [package on this page](https://github.com/boostorg/multiprecision/releases) +already includes a copy of Boost.Config so no other downloads are required. +Some functionality is reduced in this mode. +A static_assert message will alert you if a particular feature has been disabled by standalone mode. +[Boost.Math](https://github.com/boostorg/math) standalone mode is compatiable, +and recommended if special functions are required for the floating point types. ## Support, bugs and feature requests ## @@ -78,26 +95,34 @@ Bugs and feature requests can be reported through the [Gitub issue tracker](http You can submit your changes through a [pull request](https://github.com/boostorg/multiprecision/pulls). -There is no mailing-list specific to Boost Multiprecision, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [multiprecision]. +There is no mailing-list specific to `Boost Multiprecision`, +although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) +using the tag [multiprecision]. ## Development ## -Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): +Clone the whole boost project, which includes the individual Boost projects as submodules +([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): - git clone https://github.com/boostorg/boost - cd boost - git submodule update --init +```sh + git clone https://github.com/boostorg/boost + cd boost + git submodule update --init +``` -The Boost Multiprecision Library is located in `libs/multiprecision/`. +The Boost Multiprecision Library is located in `libs/multiprecision/`. ### Running tests ### First, build the B2 engine by running `bootstrap.sh` in the root of the boost directory. This will generate B2 configuration in `project-config.jam`. - - ./bootstrap.sh -Now make sure you are in `libs/multiprecision/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test: +```sh + ./bootstrap.sh +``` - ../../../b2 <- run all tests - ../../../b2 test_complex <- single test +Now make sure you are in `libs/multiprecision/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test: +```sh + ../../../b2 <- run all tests + ../../../b2 test_complex <- single test +``` From 41b39de2cb1d5d6d2564209b1516f7cee3247cab Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Wed, 3 Jul 2024 21:46:21 +0200 Subject: [PATCH 2/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0cb81959e..279635104 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Boost Multiprecision Library | Codecov | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/master) | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/develop) | -The `Boost.Multiprecision` Library provides integer, rational, floating-point, complex and interval number types in C++ that have more range and -precision than C++'s ordinary built-in types. +The `Boost.Multiprecision` is a C++ library that provides integer, rational, floating-point, complex and interval number types +having more range and precision than the language's ordinary built-in types. Language adherence: - `Boost.Multiprecision` requires a compliant C++14 compiler. From 61fbe1fd9a6659bda2890b357ea5ff52a80927cb Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Wed, 3 Jul 2024 21:46:39 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 279635104..b17f45371 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Boost Multiprecision Library | Codecov | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/master) | [![codecov](https://codecov.io/gh/boostorg/multiprecision/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/multiprecision/branch/develop) | -The `Boost.Multiprecision` is a C++ library that provides integer, rational, floating-point, complex and interval number types +`Boost.Multiprecision` is a C++ library that provides integer, rational, floating-point, complex and interval number types having more range and precision than the language's ordinary built-in types. Language adherence: From 5985811d678e37387b25cba66b3654a110fbecba Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Wed, 3 Jul 2024 21:48:57 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b17f45371..2c0882963 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Language adherence: The big number types in `Boost.Multiprecision` can be used with a wide selection of basic mathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can -also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows Boost.Multiprecision to be +also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows `Boost.Multiprecision` to be used for all kinds of mathematical calculations involving integer, rational and floating-point types requiring extended range and precision. Multiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with @@ -114,7 +114,7 @@ Clone the whole boost project, which includes the individual Boost projects as s The Boost Multiprecision Library is located in `libs/multiprecision/`. ### Running tests ### -First, build the B2 engine by running `bootstrap.sh` in the root of the boost directory. This will generate B2 configuration in `project-config.jam`. +First, build the `b2` engine by running `bootstrap.sh` in the root of the boost directory. This will generate `b2` configuration in `project-config.jam`. ```sh ./bootstrap.sh From 317627c43a7517b46bf16beb1b5e4db16fcd0814 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 24 Jul 2024 08:11:15 -0400 Subject: [PATCH 5/6] Improve detection of __float128 support --- .../boost/multiprecision/cpp_bin_float.hpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/boost/multiprecision/cpp_bin_float.hpp b/include/boost/multiprecision/cpp_bin_float.hpp index cc0ff4689..4d873b4be 100644 --- a/include/boost/multiprecision/cpp_bin_float.hpp +++ b/include/boost/multiprecision/cpp_bin_float.hpp @@ -37,7 +37,10 @@ #endif #ifdef BOOST_HAS_FLOAT128 -#include +# if __has_include() +# include +# define BOOST_MP_HAS_FLOAT128_SUPPORT +# endif #endif namespace boost { @@ -66,7 +69,7 @@ template struct is_cpp_bin_float_implicitly_constructible_from_type { static constexpr bool value = (std::numeric_limits::digits <= static_cast(bit_count)) && (std::numeric_limits::radix == 2) && std::numeric_limits::is_specialized -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT && !std::is_same::value #endif && (std::is_floating_point::value || is_number::value); @@ -82,7 +85,7 @@ template struct is_cpp_bin_float_explicitly_constructible_from_type { static constexpr bool value = (std::numeric_limits::digits > static_cast(bit_count)) && (std::numeric_limits::radix == 2) && std::numeric_limits::is_specialized -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT && !std::is_same::value #endif ; @@ -167,7 +170,7 @@ class cpp_bin_float { this->assign_float(f); } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template cpp_bin_float(const Float& f, typename std::enable_if< @@ -277,7 +280,7 @@ class cpp_bin_float } return *this; } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template typename std::enable_if< (number_category::value == number_kind_floating_point) @@ -298,7 +301,7 @@ class cpp_bin_float return assign_float(f); } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template typename std::enable_if::value && (std::numeric_limits::digits > Digits), cpp_bin_float&>::type assign_float(Float f) { @@ -371,7 +374,7 @@ class cpp_bin_float return *this; } #endif -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template typename std::enable_if::value && !std::is_same::value && (std::numeric_limits::digits > Digits), cpp_bin_float&>::type assign_float(Float f) #else @@ -382,7 +385,7 @@ class cpp_bin_float cpp_bin_float::digits, DigitBase, Allocator, Exponent, MinExponent, MaxExponent> bf(f); return *this = bf; } -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MP_HAS_FLOAT128_SUPPORT template typename std::enable_if::value && !std::is_same::value && (std::numeric_limits::digits <= Digits), cpp_bin_float&>::type assign_float(Float f) #else From 5f6780878cab3b5ecfd8fa3c26e1c1d1a0d0d43d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 8 Jul 2024 10:58:37 -0400 Subject: [PATCH 6/6] Fix node20 breakage --- .github/workflows/codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 77adb985e..ddf2bcb56 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -28,6 +28,7 @@ env: B2_LINK: shared,static LCOV_BRANCH_COVERAGE: 0 CODECOV_NAME: Github Actions + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: posix: