Skip to content

Commit 725297f

Browse files
committed
Add first draft of paper
1 parent e72fd34 commit 725297f

2 files changed

Lines changed: 161 additions & 0 deletions

File tree

paper/paper.bib

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@article{IEEE754:2008,
2+
author={},
3+
journal={IEEE Std 754-2008},
4+
title={IEEE Standard for Floating-Point Arithmetic},
5+
year={2008},
6+
volume={},
7+
number={},
8+
pages={1-70},
9+
keywords={IEEE Standards;Floating-point arithmetic;Microprocessors;Software;Hardware;Trademarks;754-2008;arithmetic;binary;computer;decimal;exponent;floating-point;format;interchange;NaN;number;rounding;significand;subnormal},
10+
doi={10.1109/IEEESTD.2008.4610935}
11+
}
12+
13+
@misc{boost,
14+
author = {The Boost Authors},
15+
title = {Boost C++ Libraries Version},
16+
year = {2025},
17+
publisher = {GitHub},
18+
journal = {GitHub repository},
19+
url = {https://github.com/boostorg/boost}
20+
}
21+
22+
@misc{ibm_libdfp,
23+
author = {The IBM Corporation},
24+
title = {Decimal Floating Point C Library},
25+
year = {2010},
26+
publisher = {GitHub},
27+
journal = {GitHub repository},
28+
url = {https://github.com/libdfp/libdfp}
29+
}
30+
31+
@misc{intel_dfp,
32+
author = {The Intel Corporation},
33+
title = {Intel(R) Decimal Floating-Point Math Library v2.3},
34+
year = {2023},
35+
publisher = {netlib},
36+
journal = {Netlib repository},
37+
url = {https://www.netlib.org/misc/intel/}
38+
}

paper/paper.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: 'Boost.Decimal: A C++14 Library for Decimal Floating Point Arithmetic'
3+
tags:
4+
- C++
5+
authors:
6+
- name: Matt Borland
7+
orcid: 0009-0005-8183-4254
8+
equal-contrib: true
9+
affiliation: 1
10+
- name: Christopher Kormanyos
11+
equal-contrib: true
12+
affiliation: 2
13+
affiliations:
14+
- name: The C++ Alliance
15+
index: 1
16+
- name: Independent Researcher, Germany
17+
index: 2
18+
date: 04 February 2025
19+
bibliography: paper.bib
20+
---
21+
22+
# Summary
23+
24+
Boost.Decimal is a header-only, C++14 implementation of IEEE 754 decimal floating-point arithmetic types, integrating seamlessly with the C++ Standard Template Library and other Boost Libraries.
25+
The library is available at [https://github.com/boostorg/decimal](https://github.com/boostorg/decimal), and the Boost distribution with most standard package managers starting from version 1.91, which will be released in March 2026.
26+
27+
# Statement of need
28+
29+
In the 2008 revision of IEEE 754 [@IEEE754:2008], decimal floating-point arithmetic was standardized.
30+
These types are critical in applications where decimal numbers must be represented exactly, such as financial software.
31+
Binary floating-point representations cannot precisely store common decimal values like 0.1, leading to subtle rounding errors that accumulate over repeated calculations.
32+
In accounting systems, this can result in discrepancies that violate regulatory requirements or erode user trust.
33+
Prior to Boost.Decimal, no cross-platform C++ library provided IEEE 754 decimal arithmetic or the associated types.
34+
35+
# State of the field
36+
37+
The two main implementations in this space are produced by IBM [@ibm_libdfp] and Intel [@intel_dfp], with the latter representing the industry standard.
38+
These libraries have two shortcomings that Boost.Decimal aims to address.
39+
40+
First, both libraries are fundamentally C libraries.
41+
This can make integration into modern C++ applications awkward, and they lack support for C++-specific functionality provided in the Standard Library.
42+
43+
Second, neither library is cross-platform.
44+
For instance, if you wanted to use either of these on an ARM64 processor, you would be out of luck.
45+
Boost.Decimal addresses both of these shortcomings.
46+
47+
# Software design
48+
49+
Boost.Decimal's design philosophy emphasizes ease of use, portability, and performance.
50+
51+
To make the library easy to consume, it requires only C++14 and is header-only with zero external dependencies.
52+
Users can simply clone the repository, add `#include <boost/decimal.hpp>`, and begin using the library, even with older toolchains such as `clang++-6`.
53+
54+
Portability is a primary design concern.
55+
We test the library on all three major operating system families (Linux, Windows, and macOS) across a variety of architectures: x86-32, x86-64, ARM32, ARM64, S390X, and PPC64LE.
56+
Our continuous integration pipeline ensures consistent numerical results across all supported platforms.
57+
58+
Performance is also a priority.
59+
Extensive benchmarking demonstrates that Boost.Decimal outperforms both the Intel and IBM libraries across a variety of platforms.
60+
Benchmark results and methodology are available in the repository documentation.
61+
62+
A minimal usage example showing the representation difference between decimal and binary floating point arithmetic:
63+
64+
```c++
65+
#include <boost/decimal.hpp> // This includes the entire decimal library
66+
#include <iostream>
67+
#include <iomanip>
68+
69+
int main()
70+
{
71+
using namespace boost::decimal::literals; // The literals are in their own namespace like std::literals
72+
73+
// First we show the result of 0.1 + 0.2 using regular doubles
74+
std::cout << std::fixed << std::setprecision(17)
75+
<< "Using doubles:\n"
76+
<< "0.1 + 0.2 = " << 0.1 + 0.2 << "\n\n";
77+
78+
// Construct the two decimal values
79+
// We construct using the literals defined by the library
80+
constexpr boost::decimal::decimal64_t a {0.1_DD};
81+
constexpr boost::decimal::decimal64_t b {0.2_DD};
82+
83+
// Now we display the result of the same calculation using decimal64_t
84+
std::cout << "Using decimal64_t:\n"
85+
<< "0.1_DD + 0.2_DD = " << a + b << std::endl;
86+
}
87+
```
88+
And the expected output is:
89+
```
90+
Using doubles:
91+
0.1 + 0.2 = 0.30000000000000004
92+
93+
Using decimal64_t:
94+
0.1_DD + 0.2_DD = 0.3000000000000000
95+
```
96+
97+
# Research Impact Statement
98+
99+
Boost.Decimal enables reproducible numerical research in domains where decimal precision is essential.
100+
The library's cross-platform consistency ensures that computational results are identical regardless of hardware architecture, a critical property for scientific reproducibility.
101+
102+
Financial modeling and econometrics: Quantitative finance research frequently involves calculations on currency values, interest rates, and transaction amounts that are inherently decimal.
103+
Binary floating-point approximations can introduce systematic biases in Monte Carlo simulations, risk calculations, and backtesting frameworks.
104+
Boost.Decimal allows researchers to eliminate these artifacts and produce results that match real-world financial systems.
105+
106+
Numerical analysis and error propagation studies: Researchers investigating floating-point error accumulation can use Boost.Decimal as a reference implementation to compare against binary floating-point results.
107+
This facilitates studies on when decimal arithmetic provides meaningful accuracy improvements over binary representations.
108+
109+
Embedded and cross-architecture research: Unlike existing implementations, Boost.Decimal runs on ARM and other non-x86 architectures.
110+
This enables research on decimal arithmetic performance and applications in embedded systems, and other platforms.
111+
112+
# AI usage disclosure
113+
114+
No generative AI tools were used in the development of this software, the writing
115+
of this manuscript, or the preparation of supporting materials.
116+
117+
# Acknowledgements
118+
119+
We acknowledge The C++ Alliance for sponsoring the development of this work.
120+
The library underwent peer review in January and October 2025 by domain experts before acceptance into the Boost library collection.
121+
We thank all of these reviewers for their time and contributions.
122+
123+
# References

0 commit comments

Comments
 (0)