{"id":20077206,"url":"https://github.com/boostorg/multiprecision","last_synced_at":"2025-05-16T03:05:47.981Z","repository":{"id":6832242,"uuid":"8080572","full_name":"boostorg/multiprecision","owner":"boostorg","description":"Boost.Multiprecision","archived":false,"fork":false,"pushed_at":"2025-05-05T13:08:06.000Z","size":25694,"stargazers_count":216,"open_issues_count":69,"forks_count":121,"subscribers_count":18,"default_branch":"develop","last_synced_at":"2025-05-05T14:27:20.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boostorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-02-07T20:02:49.000Z","updated_at":"2025-04-29T15:31:27.000Z","dependencies_parsed_at":"2023-10-20T18:32:35.851Z","dependency_job_id":"f128bfa8-df9c-4ffc-ba65-0a1b5e1380e3","html_url":"https://github.com/boostorg/multiprecision","commit_stats":{"total_commits":1913,"total_committers":56,"mean_commits":"34.160714285714285","dds":"0.29482488238369053","last_synced_commit":"02e753d60364d2318827a98f7b12d98cc60244a4"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fmultiprecision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fmultiprecision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fmultiprecision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fmultiprecision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boostorg","download_url":"https://codeload.github.com/boostorg/multiprecision/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T15:06:34.310Z","updated_at":"2025-05-16T03:05:42.972Z","avatar_url":"https://github.com/boostorg.png","language":"C++","readme":"Boost Multiprecision Library\n============================\n\n|                  |  Master  |   Develop   |\n|------------------|----------|-------------|\n| 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) |\n| Github Actions   | [![Build Status](https://github.com/boostorg/multiprecision/actions/workflows/multiprecision.yml/badge.svg?branch=master)](https://github.com/boostorg/multiprecision/actions?query=branch%3Amaster) | [![Build Status](https://github.com/boostorg/multiprecision/actions/workflows/multiprecision.yml/badge.svg?branch=develop)](https://github.com/boostorg/multiprecision/actions?query=branch%3Adevelop) |\n| 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) |\n\n\n`Boost.Multiprecision` is a C++ library that provides integer, rational, floating-point, complex and interval number types\nhaving more range and precision than the language's ordinary built-in types.\n\nLanguage adherence:\n  - `Boost.Multiprecision` requires a compliant C++14 compiler.\n  - It is compatible with C++14, 17, 20, 23 and beyond.\n\nThe big number types in `Boost.Multiprecision` can be used with a wide selection of basic\nmathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can\nalso interoperate with the built-in types in C++ using clearly defined conversion rules. This allows `Boost.Multiprecision` to be\nused for all kinds of mathematical calculations involving integer, rational and floating-point types requiring extended range and precision.\n\nMultiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with\nsupport for integer, rational and floating-point types. `Boost.Multiprecision` provides a selection of back ends delivered off-the-rack in\nincluding interfaces to GMP, MPFR, MPIR, TomMath as well as its own collection of Boost-licensed, header-only back ends for integers,\nrationals, floats and complex. In addition, user-defined back ends can be created and used with the interface of Multiprecision,\npresuming that the class implementation adheres to the necessary concepts.\n\nDepending upon the multiprecision type, precision may be arbitrarily large (limited only by available memory),\nfixed at compile time (for example $50$ or $100$ decimal digits),\nor variable controlled at run-time by member functions.\nExpression templates can be enabled or disabled when configuring the `number` type with its backend.\nMost of the multiprecision types are expression-template-enabled by default.\nThis usually provides better performance than types configured without expression templates.\n\nThe full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/multiprecision/index.html).\n\n## Using Multiprecision\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://godbolt.org/z/eEdT1EMzn\" alt=\"godbolt\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/try%20it%20on-godbolt-green\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nIn the following example, we use Multiprecision's Boost-licensed binary\nfloating-point backend type `cpp_bin_float` to compute ${\\sim}100$ decimal digits of\n\n$$\\sqrt{\\pi} = \\Gamma \\left( \\frac{1}{2} \\right)~{\\approx}~1.772453850905516027298{\\ldots}\\text{,}$$\n\nwhere we also observe that Multiprecision can seemlesly interoperate with\n[Boost.Math](https://github.com/boostorg/math).\n\n```cpp\n// ------------------------------------------------------------------------------\n// Copyright Christopher Kormanyos 2024 - 2025.\n// Distributed under the Boost Software License,\n// Version 1.0. (See accompanying file LICENSE_1_0.txt\n// or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n\n#include \u003cboost/math/special_functions/gamma.hpp\u003e\n#include \u003cboost/multiprecision/cpp_bin_float.hpp\u003e\n\n#include \u003ciomanip\u003e\n#include \u003ciostream\u003e\n#include \u003csstream\u003e\n\nauto main() -\u003e int\n{\n  // Configure a multiprecision binary floating-point type with approximately\n  // 100 decimal digits of precision and expression templates enabled.\n  // Note that the popular type cpp_bin_float_100 has already been preconfigured\n  // and aliased in the multiprecision headers.\n\n  using big_float_type = boost::multiprecision::cpp_bin_float_100;\n\n  // In the next few lines, compute and compare sqrt(pi) with tgamma(1/2)\n  // using the 100-digit multiprecision type.\n\n  const big_float_type sqrt_pi { sqrt(boost::math::constants::pi\u003cbig_float_type\u003e()) };\n\n  const big_float_type half { big_float_type(1) / 2 };\n\n  const big_float_type gamma_half { boost::math::tgamma(half) }; \n\n  std::stringstream strm { };\n\n  strm \u003c\u003c std::setprecision(std::numeric_limits\u003cbig_float_type\u003e::digits10)\n       \u003c\u003c \"sqrt_pi   : \"\n       \u003c\u003c sqrt_pi\n       \u003c\u003c \"\\ngamma_half: \"\n       \u003c\u003c gamma_half;\n\n  std::cout \u003c\u003c strm.str() \u003c\u003c std::endl;\n}\n```\n\n## Standalone\n\nDefining `BOOST_MP_STANDALONE` allows `Boost.Multiprecision`\nto be used with the only dependency being [Boost.Config](https://github.com/boostorg/config).\n\nOur [package on this page](https://github.com/boostorg/multiprecision/releases)\nalready includes a copy of Boost.Config so no other downloads are required.\nSome functionality is reduced in this mode.\nA `static_assert` message will alert you if a particular feature has been disabled by standalone mode.\n[Boost.Math](https://github.com/boostorg/math) standalone mode is compatiable,\nand recommended if special functions are required for the floating point types.\n\n## Support, bugs and feature requests\n\nBugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/multiprecision/issues)\n(see [open issues](https://github.com/boostorg/multiprecision/issues) and\n[closed issues](https://github.com/boostorg/multiprecision/issues?utf8=%E2%9C%93\u0026q=is%3Aissue+is%3Aclosed)).\n\nYou can submit your changes through a [pull request](https://github.com/boostorg/multiprecision/pulls).\n\nThere is no mailing-list specific to `Boost Multiprecision`,\nalthough you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users)\nusing the tag [multiprecision].\n\n\n## Development\n\nClone the whole boost project, which includes the individual Boost projects as submodules\n([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):\n\n```sh\n  git clone https://github.com/boostorg/boost\n  cd boost\n  git submodule update --init\n```\n\nThe Boost Multiprecision Library is located in `libs/multiprecision/`.\n\n### Running tests\n\nFirst, build the `b2` engine by running `bootstrap.sh` in the root of the boost directory. This will generate `b2` configuration in `project-config.jam`.\n\n```sh\n  ./bootstrap.sh\n```\n\nNow make sure you are in `libs/multiprecision/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test:\n\n```sh\n  ../../../b2                        \u003c- run all tests\n  ../../../b2 test_complex           \u003c- single test\n```\n","funding_links":[],"categories":["Math"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostorg%2Fmultiprecision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboostorg%2Fmultiprecision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostorg%2Fmultiprecision/lists"}