Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
7b629b5
MSVC added constexpr support to their 128-bit ints
mborland Apr 28, 2026
1042ef3
Remove non-ascii
mborland Apr 28, 2026
5fdae75
Add comparison to MP page
mborland Apr 28, 2026
81abd58
Merge pull request #386 from cppalliance/MSVC
mborland Apr 28, 2026
f5d7ca1
Merge pull request #387 from cppalliance/385
mborland Apr 28, 2026
0d8d7f7
Remove deviations of sign conversion and sign compare
mborland Apr 29, 2026
afd521d
Remove sign compare
mborland Apr 29, 2026
d3d9431
Add test ensuring correct conversions
mborland Apr 29, 2026
b3ed6e5
Update examples
mborland Apr 29, 2026
4aaf85d
Update documentation
mborland Apr 29, 2026
603c7bd
Add additional cross type operators
mborland Apr 29, 2026
f3abbbe
Add additional bitwise testing
mborland Apr 29, 2026
75b2b2a
Add specific documentation on promotions
mborland Apr 29, 2026
f090366
Remove non-ascii characters
mborland Apr 29, 2026
ad897c3
Fix is_integeral errors
mborland Apr 29, 2026
83063b6
Fix MSVC errors
mborland Apr 29, 2026
b08796a
Avoid UB in tests
mborland Apr 29, 2026
28c75d3
Fix two's complement and UB
mborland Apr 29, 2026
a81105e
More two's - complement
mborland Apr 29, 2026
d0a665f
Allow more standard functions for MSVC builtins
mborland Apr 29, 2026
0b52ede
Fix yet another MSVC bug
mborland Apr 29, 2026
ec0065d
More MSVC repairs
mborland Apr 30, 2026
15b6340
Fix unused variable for test that dont run
mborland Apr 30, 2026
a6e44c6
More unused variable for clang on win
mborland Apr 30, 2026
465721a
Merge pull request #390 from cppalliance/388
mborland Apr 30, 2026
165cffa
Fix potential overflow for bases greater than 10
mborland May 6, 2026
96722bf
Test edges of overflow
mborland May 6, 2026
096d400
Fix consteval fallthrough
mborland May 7, 2026
7054398
Fix usage of C++17 features
mborland May 7, 2026
eef20fa
Add missing header
mborland May 7, 2026
cf223eb
Add missing header
mborland May 7, 2026
154acf7
Attempt GCC 12 workaround
mborland May 7, 2026
c741952
Merge pull request #393 from cppalliance/div
mborland May 7, 2026
cf2f0d4
Merge pull request #392 from cppalliance/overflow
mborland May 7, 2026
33baa69
Update construction examples
mborland May 7, 2026
838f8bb
Remove unsigned long long literal overloads
mborland May 11, 2026
f9c6a7c
Update example to use literals
mborland May 11, 2026
3080a9a
Add rationale to literals.adoc
mborland May 11, 2026
ccdf818
Update comment on construction
mborland May 11, 2026
a793f10
Merge pull request #395 from cppalliance/391
mborland May 11, 2026
3ffbf4a
Add a modular power function
mborland May 11, 2026
7eb999c
Add testing of powm
mborland May 11, 2026
8859f79
Add utilities doc page
mborland May 11, 2026
a201d64
Skip testing on GCC7 32 bit due to constexpr limits
mborland May 12, 2026
56c0039
Make types explicit for CUDA
mborland May 12, 2026
e6e59c0
Merge pull request #399 from cppalliance/394
mborland May 12, 2026
1293fc0
Cross type conversions should be implicit
mborland May 12, 2026
7cf5030
Add testing
mborland May 12, 2026
2427103
Remove unneeded conversion
mborland May 12, 2026
217718b
Make the other conversions implict
mborland May 12, 2026
98737e1
Add testing of now implicit conversions
mborland May 12, 2026
bfdefab
Add floating point trait
mborland May 12, 2026
48c5344
Add floating point constructors
mborland May 12, 2026
c7a9cc6
Add testing of floating point constructors
mborland May 12, 2026
5931888
Update doc pages
mborland May 12, 2026
6f03424
Update examples and output
mborland May 12, 2026
e6635cf
Fix warnings
mborland May 12, 2026
7e5ae9f
Fix non-constexpr errors
mborland May 12, 2026
e69f3fa
Merge pull request #401 from cppalliance/conversion
mborland May 12, 2026
e168075
Add boost::hash_combine style hashing
mborland May 12, 2026
11851a5
Add testing of hashing
mborland May 12, 2026
a120020
Add hash docs
mborland May 12, 2026
eccb7aa
Use mixer to work with 32 bit platforms
mborland May 12, 2026
fc2d732
Ignore use-less cast that's not useless in 32 bits
mborland May 15, 2026
abd8979
Ignore padding warning from MSVC STL
mborland May 15, 2026
ae034fd
Merge pull request #404 from cppalliance/402
mborland May 15, 2026
396e41b
Add ipow implementation
mborland May 15, 2026
c0c9d3f
Add ipow testing
mborland May 15, 2026
31531a7
Exclude gcc-7 x32
mborland May 15, 2026
86a904d
Ignore old MSVC warning
mborland May 15, 2026
ad18eb3
Fix MSVC 14.2 warning
mborland May 18, 2026
a93e2ae
Merge pull request #405 from cppalliance/397
mborland May 18, 2026
eed7404
Implement isqrt
mborland May 15, 2026
717d89e
Test isqrt
mborland May 15, 2026
477622b
Exclude gcc-7 x32
mborland May 15, 2026
6c85c62
Fix copy-paste error
mborland May 19, 2026
c8a4cd6
Ignore MSVC warnings from 14.2
mborland May 19, 2026
9a8589b
Merge pull request #406 from cppalliance/sqrt
mborland May 19, 2026
f98c88d
Bump the all-dependencies group in /doc with 3 updates
dependabot[bot] May 27, 2026
3618337
Merge pull request #407 from cppalliance/dependabot/npm_and_yarn/doc/…
mborland Jun 1, 2026
f7c0cb0
Implment ckd_add
mborland Jun 1, 2026
0f26bbf
Test ckd_add
mborland Jun 1, 2026
133b1e1
Reject bool and char per C23
mborland Jun 1, 2026
7706a89
Add ckd_sub and ckd_mul
mborland Jun 1, 2026
88d92c2
Test new functions
mborland Jun 1, 2026
ef2ed4b
Add checked arithmetic example
mborland Jun 1, 2026
51ed17e
Update utilities and api reference
mborland Jun 1, 2026
625d7f2
Add example to main examples page
mborland Jun 1, 2026
094719e
Attempt fix old compiler problems
mborland Jun 1, 2026
9c0a7c9
Disable constexpr testing with GCC-7
mborland Jun 1, 2026
051606b
Merge pull request #409 from cppalliance/checked
mborland Jun 1, 2026
0ead601
Optimize mul so we never use knuth
mborland Jun 1, 2026
c75d4af
Add config option for divq
mborland Jun 1, 2026
3f52495
Optimize common div
mborland Jun 1, 2026
38b22bd
Update driver
mborland Jun 1, 2026
d8359a1
Add additional testing and benchmarks
mborland Jun 1, 2026
7cf83ab
Implement optimizations for signed types
mborland Jun 1, 2026
3280f99
Consolidate MSVC div
mborland Jun 2, 2026
109c4ba
Fix for CUDA path
mborland Jun 2, 2026
9f2c7c2
Disable test_ckd constexpr for old GCC
mborland Jun 2, 2026
34aa9d3
Remove ancient macOS version
mborland Jun 2, 2026
8217e60
Fix shadowing
mborland Jun 2, 2026
5af4fe3
Fix unreferenced formal parameter warning
mborland Jun 2, 2026
4be005a
Improve generation method of performance plots
mborland Jun 2, 2026
3a61d6d
Add additional newer GCC and Clang versions
mborland Jun 2, 2026
2601d22
Fix broken pipe
mborland Jun 2, 2026
b5e5417
Attempt performance increase for 390x mul
mborland Jun 2, 2026
d5c0480
Ignore MSVC 14.1 warning
mborland Jun 2, 2026
5a34f59
Fix new UBSAN error
mborland Jun 2, 2026
04fd9f7
More UBSAN and ASAN fixes
mborland Jun 2, 2026
f0f5221
Fix sqrt
mborland Jun 2, 2026
049e6be
Install absl
mborland Jun 2, 2026
e55c6e6
Ignore MSVC
mborland Jun 2, 2026
bf76e1d
Update performance values and graphs
mborland Jun 3, 2026
fb37592
Merge pull request #411 from cppalliance/opt_mul
mborland Jun 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 53 additions & 13 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright 2022, 2023 Peter Dimov
# Copyright 2025 - 2026 Matt Borland
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

local library = "decimal";
local library = "int128";

local triggers =
{
Expand All @@ -23,9 +24,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
os: "linux",
arch: arch
},
clone:
{
retries: 5,
"clone": {
"retries": 5
},
steps:
[
Expand All @@ -37,7 +37,9 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
commands:
[
'set -e',
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
'echo $DRONE_STAGE_MACHINE',
'uname -a',
'curl -sSL --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg',
] +
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
Expand Down Expand Up @@ -267,6 +269,34 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"g++-14-multilib",
),

linux_pipeline(
"Linux 26.04 GCC 15 32",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-15', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32', CXXFLAGS: "-fexcess-precision=fast" },
"g++-15-multilib",
),

linux_pipeline(
"Linux 26.04 GCC 15 64",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-15', CXXSTD: '03,11,14,17,20,23', ADDRMD: '64', CXXFLAGS: "-fexcess-precision=fast" },
"g++-15-multilib",
),

linux_pipeline(
"Linux 26.04 GCC 16 32",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-16', CXXSTD: '03,11,14,17,20,23', ADDRMD: '32', CXXFLAGS: "-fexcess-precision=fast" },
"g++-16-multilib",
),

linux_pipeline(
"Linux 26.04 GCC 16 64",
"cppalliance/droneubuntu2604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-16', CXXSTD: '03,11,14,17,20,23', ADDRMD: '64', CXXFLAGS: "-fexcess-precision=fast" },
"g++-16-multilib libabsl-dev",
),

linux_pipeline(
"Linux 18.04 Clang 5.0",
"cppalliance/droneubuntu1804:1",
Expand Down Expand Up @@ -386,17 +416,27 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
),

linux_pipeline(
"Linux 24.04 Clang 20 ASAN",
"Linux 24.04 Clang 21",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-20', CXXSTD: '03,11,14,17,20,23,2c' } + asan,
"clang-20",
["deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"],
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '17,20,2b' },
"clang-21",
["deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"],
),

linux_pipeline(
"Linux 24.04 Clang 21 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '17,20,2b' } + ubsan,
"clang-21",
["deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"],
),

macos_pipeline(
"MacOS Xcode 14.3.1",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + asan,
xcode_version = "14.3.1", osx_version = "sonoma", arch = "arm64",
linux_pipeline(
"Linux 24.04 Clang 21 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '17,20,2b' } + asan,
"clang-21",
["deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"],
),

windows_pipeline(
Expand Down
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/ARM32_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/ARM64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/ppc64le_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/s390x_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/x64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/linux/x86_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/macos/ARM64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file modified doc/modules/ROOT/images/i128_graphs/windows/ARM64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/windows/x64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/i128_graphs/windows/x86_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/ARM32_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/ARM64_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/ppc64le_benchmarks.png
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/s390x_benchmarks.png
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/x64_benchmarks.png
Binary file modified doc/modules/ROOT/images/u128_graphs/linux/x86_benchmarks.png
Binary file modified doc/modules/ROOT/images/u128_graphs/macos/ARM64_benchmarks.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified doc/modules/ROOT/images/u128_graphs/windows/x64_benchmarks.png
Binary file modified doc/modules/ROOT/images/u128_graphs/windows/x86_benchmarks.png
10 changes: 10 additions & 0 deletions doc/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
** xref:examples.adoc#examples_bit[`<bit>` support]
** xref:examples.adoc#examples_numeric[`<numeric>` support (Saturating Arithmetic)]
** xref:examples.adoc#examples_numeric_algorithms[`<numeric>` support (Numeric Algorithms)]
** xref:examples.adoc#examples_checked[Checked Arithmetic]
** xref:examples.adoc#examples_mixed_sign[Mixed Signedness Arithmetic]
** xref:examples.adoc#examples_to_string[String Conversion (to_string)]
** xref:examples.adoc#examples_boost_math_random[Boost Math and Random Integration]
Expand All @@ -23,10 +24,12 @@
*** xref:api_reference.adoc#api_cstdlib[`<cstdlib>`]
*** xref:api_reference.adoc#api_charconv[`<charconv>`]
*** xref:api_reference.adoc#api_cmath[`<cmath>`]
*** xref:api_reference.adoc#api_functional[`<functional>`]
*** xref:api_reference.adoc#api_iostream[`<iostream>`]
*** xref:api_reference.adoc#api_ios[`<ios>`]
*** xref:api_reference.adoc#api_numeric[`<numeric>`]
*** xref:api_reference.adoc#api_string[`<string>`]
*** xref:api_reference.adoc#api_utilities[Utilities]
** xref:api_reference.adoc#api_macros[Macros]
*** xref:api_reference.adoc#api_macro_literals[Literals]
*** xref:api_reference.adoc#api_macro_configuration[Configuration]
Expand All @@ -53,8 +56,14 @@
* xref:cstdlib.adoc[]
* xref:charconv.adoc[]
* xref:stream.adoc[]
* xref:hash.adoc[]
* xref:numeric.adoc[]
* xref:string.adoc[]
* xref:utilities.adoc[]
** xref:utilities.adoc#powm[Modular Exponentiation]
** xref:utilities.adoc#ipow[Integer Power]
** xref:utilities.adoc#isqrt[Integer Square Root]
** xref:utilities.adoc#checked[Checked Arithmetic]
* Benchmarks
** xref:u128_benchmarks.adoc[]
*** xref:u128_benchmarks.adoc#u128_linux[Linux]
Expand All @@ -64,5 +73,6 @@
*** xref:i128_benchmarks.adoc#i128_linux[Linux]
*** xref:i128_benchmarks.adoc#i128_windows[Windows]
*** xref:i128_benchmarks.adoc#i128_mac[macOS]
* xref:comp_to_multiprecision.adoc[]
* xref:reference.adoc[]
* xref:copyright.adoc[]
58 changes: 52 additions & 6 deletions doc/modules/ROOT/pages/api_reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ https://www.boost.org/LICENSE_1_0.txt
| https://en.cppreference.com/w/cpp/types/numeric_limits[`std::numeric_limits<int128_t>`]
| Numeric limits specialization for `int128_t`

| xref:hash.adoc[`std::hash<uint128_t>`]
| Hash specialization for `uint128_t`

| xref:hash.adoc[`std::hash<int128_t>`]
| Hash specialization for `int128_t`

| xref:cstdlib.adoc#div_structs[`u128div_t`]
| Result type for `div(uint128_t, uint128_t)`

Expand Down Expand Up @@ -164,6 +170,20 @@ Listed by analogous STL header.
| Computes quotient and remainder simultaneously
|===

[#api_functional]
=== xref:hash.adoc[`<functional>`]

[cols="1,2", options="header"]
|===
| Specialization | Description

| xref:hash.adoc[`std::hash<uint128_t>`]
| Enables `uint128_t` as a key in unordered associative containers

| xref:hash.adoc[`std::hash<int128_t>`]
| Enables `int128_t` as a key in unordered associative containers
|===

[#api_formatting]
=== xref:format.adoc[Formatting]

Expand Down Expand Up @@ -257,6 +277,32 @@ Listed by analogous STL header.
| `std::string` conversion of base-10 values
|===

[#api_utilities]
=== xref:utilities.adoc[Utilities]

[cols="1,2", options="header"]
|===
| Function | Description

| xref:utilities.adoc#powm[`powm`]
| Modular exponentiation `(base ^ exp) mod m`

| xref:utilities.adoc#ipow[`ipow`]
| Integer power `base ^ exp` (wraps modulo `2^128`)

| xref:utilities.adoc#isqrt[`isqrt`]
| Integer square root `floor(sqrt(n))`

| xref:utilities.adoc#checked[`ckd_add`]
| Checked addition (C23 `<stdckdint.h>` contract)

| xref:utilities.adoc#checked[`ckd_sub`]
| Checked subtraction (C23 `<stdckdint.h>` contract)

| xref:utilities.adoc#checked[`ckd_mul`]
| Checked multiplication (C23 `<stdckdint.h>` contract)
|===

[#api_macros]
== Macros

Expand Down Expand Up @@ -302,12 +348,6 @@ Listed by analogous STL header.
| xref:config.adoc#no_int128[`BOOST_INT128_NO_BUILTIN_INT128`]
| Disables use of compiler built-in `__int128`

| xref:config.adoc#sign_compare[`BOOST_INT128_ALLOW_SIGN_COMPARE`]
| Allows comparison between signed and unsigned types

| xref:config.adoc#sign_conversion[`BOOST_INT128_ALLOW_SIGN_CONVERSION`]
| Allows implicit sign conversion

| xref:config.adoc#disable_exceptions[`BOOST_INT128_DISABLE_EXCEPTIONS`]
| Disables exception throwing

Expand Down Expand Up @@ -362,6 +402,9 @@ Listed by analogous STL header.
| xref:format.adoc#std_format[`<boost/int128/format.hpp>`]
| Formatting integration for pass:[C++20] `<format>`

| xref:hash.adoc[`<boost/int128/hash.hpp>`]
| `std::hash` specializations for `int128_t` and `uint128_t`

| `<boost/int128/int128.hpp>`
| The xref:uint128_t.adoc[`uint128_t`] and xref:int128_t.adoc[`int128_t`] types

Expand All @@ -383,4 +426,7 @@ Listed by analogous STL header.
| `<boost/int128/random.hpp>`
| Required for usage of Boost.Random

| xref:utilities.adoc[`<boost/int128/utilities.hpp>`]
| Modular exponentiation and other library-specific utilities

|===
19 changes: 19 additions & 0 deletions doc/modules/ROOT/pages/comp_to_multiprecision.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
////
Copyright 2026 Matt Borland
Distributed under the Boost Software License, Version 1.0.
https://www.boost.org/LICENSE_1_0.txt
////

[#mp]
= Comparison to Boost.Multiprecision

An easy question to ask is why this is a separate library from Boost.Multiprecision.
There are several reasons why:

- The goal is for this library to be extremely lightweight.
The module weight of this library will be 5, whereas https://pdimov.github.io/boostdep-report/develop/module-weights.html[Boost.Multiprecision is 25]
- Fundamentally, the designs of the types are different.
In Boost.Multiprecision, `int128` and `uint128` are incident to the arbitrary precision integer `cpp_int`, not a specifically designed type.
In this library both `int128_t` and `uint128_t` are their own classes with individually implemented operators to maximize performance.
- In Boost.Multiprecision all types are based on a high-level template `number` to allow interoperability with each other.
Again, both `int128_t` and `uint128_t` are their own classes, and are designed to work with and act like the built-in integer types.
10 changes: 0 additions & 10 deletions doc/modules/ROOT/pages/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ Allowed functions have `BOOST_INT128_HOST_DEVICE` as part of their function sign
[#no_int128]
- `BOOST_INT128_NO_BUILTIN_INT128`: The user may define this when they do not want the internal implementations to rely on builtin `pass:[__int128]` or `pass:[unsigned __int128]` types.

[#sign_compare]
- `BOOST_INT128_ALLOW_SIGN_COMPARE`: Allows comparisons between this library's types and built-in types of opposite signedness. Analogous to disabling GCC's `-Wsign-compare` warning.

IMPORTANT: NOT DEFINED BY DEFAULT FOR CORRECTNESS

[#sign_conversion]
- `BOOST_INT128_ALLOW_SIGN_CONVERSION`: Allows arithmetic operations between this library's types and built-in types of opposite signedness. Analogous to disabling GCC's `-Wsign-conversion` warning. Implies `BOOST_INT128_ALLOW_SIGN_COMPARE`.

IMPORTANT: NOT DEFINED BY DEFAULT FOR CORRECTNESS

[#disable_exceptions]
- `BOOST_INT128_DISABLE_EXCEPTIONS`: Allows exceptions to be disabled.
This macro will automatically be defined in the presence of `-fno-exceptions` or similar MSVC flags.
Expand Down
55 changes: 51 additions & 4 deletions doc/modules/ROOT/pages/examples.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,36 @@ From builtin (42U): 42
From parts (1, 0) = 2^64: 18446744073709551616
From parts (max, max): 340282366920938463463374607431768211455
Equals numeric_limits max? true
From literal "36893488147419103232"_U128: 36893488147419103232
From literal 12345_U128: 12345
From BOOST_INT128_UINT128_C(max): 340282366920938463463374607431768211455
From stringstream: 12345678901234567890123456789

=== int128_t Construction ===
From builtin (-42): -42
From parts (INT64_MIN, 0): -170141183460469231731687303715884105728
Equals numeric_limits min? true
From literal "-99999999999999999999"_i128: -99999999999999999999
From literal "99999999999999999999"_I128: 99999999999999999999
From literal -12345_i128: -12345
From literal 12345_I128: 12345
From BOOST_INT128_INT128_C(-99999999999999999999): -99999999999999999999
From string literal: -99999999999999999999
From BOOST_INT128_INT128_C(min): -170141183460469231731687303715884105728

=== Default and Copy Construction ===
Default constructed: 0
Copy constructed: 36893488147419103232
Copy constructed: 340282366920938463463374607431768211455

=== Floating-Point Construction ===
uint128_t from 12345.9 (truncated): 12345
int128_t from -12345.9 (truncated toward zero): -12345
uint128_t from 2^100: 1267650600228229401496703205376

=== Floating-Point Edge Cases ===
uint128_t from NaN: 0
int128_t from NaN: 0
uint128_t from -1.0 (clamped to zero): 0
uint128_t from +infinity (saturates to UINT128_MAX): 340282366920938463463374607431768211455
int128_t from 1e40 (saturates to INT128_MAX): 170141183460469231731687303715884105727
int128_t from -1e40 (saturates to INT128_MIN): -170141183460469231731687303715884105728
----
====

Expand Down Expand Up @@ -263,6 +278,38 @@ midpoint(-100, -50) = -75
----
====

[#examples_checked]
== Checked Arithmetic

.This https://github.com/cppalliance/int128/blob/develop/examples/checked_arithmetic.cpp[example] demonstrates checked addition, subtraction, and multiplication following the C23 checked-integer contract
====
[source, c++]
----
include::example$checked_arithmetic.cpp[]
----

.Expected Output
[listing]
----
=== Results That Fit ===
ckd_add(20, 22): overflow=false, result=42

=== Addition Overflow ===
ckd_add(UINT128_MAX, 1): overflow=true, wrapped=0

=== Subtraction Underflow ===
ckd_sub(0, 1): overflow=true, wrapped=340282366920938463463374607431768211455

=== Multiplication Overflow ===
ckd_mul(INT128_MAX, 2): overflow=true, wrapped=-2
ckd_mul(INT128_MIN, -1): overflow=true, wrapped=-170141183460469231731687303715884105728

=== Mixed Types ===
ckd_add<int64_t>(uint128_t{5}, int128_t{-3}): overflow=false, result=2
ckd_mul<uint8_t>(20, 20): overflow=true, wrapped=144
----
====

[#examples_mixed_sign]
== Mixed Signedness Arithmetic

Expand Down
3 changes: 3 additions & 0 deletions doc/modules/ROOT/pages/file_structure.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ The entire library can be consumed via `<boost/int128.hpp>`, or by independently
| xref:format.adoc[`<boost/int128/format.hpp>`]
| C++20 `std::format` support

| xref:hash.adoc[`<boost/int128/hash.hpp>`]
| `std::hash` specializations for `int128_t` and `uint128_t`

| `<boost/int128/int128.hpp>`
| Core type definitions (`uint128_t`, `int128_t`)

Expand Down
Loading
Loading