Decimal
A C++14 Implementation of IEEE 754 Decimal Floating Point Numbers
Install / Use
/learn @boostorg/DecimalREADME
Boost.Decimal
| | Master | Develop |
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| Drone | |
|
| Github Actions |
|
| Codecov |
|
|
| Fuzzing |
|
|
| Metal |
|
|
Boost.Decimal is an implementation of IEEE 754 and ISO/IEC DTR 24733 Decimal Floating Point numbers. The library is header-only, has no dependencies, and requires C++14.
How To Use The Library
This library is header only. It contains no other dependencies.
Simply #include it and use it.
CMake
git clone https://github.com/boostorg/decimal
cd decimal
mkdir build && cd build
cmake .. OR cmake .. -DCMAKE_INSTALL_PREFIX=/your/custom/path
cmake --build . --target install
then you can use find_package(boost_decimal REQUIRED)
vcpkg
Available in official vcpkg sources soon
Conan
Available in official conan sources soon
Supported Platforms
Boost.Decimal is tested natively on Ubuntu (x86_64, s390x, and aarch64), macOS (x86_64, and Apple Silicon), and Windows (x32 and x64); as well as emulated PPC64LE and ARM Cortex-M using QEMU with the following compilers:
- GCC 8 and later
- Clang 6 and later
- Visual Studio 2019 and later
- Intel OneAPI DPC++
Synopsis
Decimal provides 3 IEEE-754 compliant types:
namespace boost {
namespace decimal {
class decimal32_t;
class decimal64_t;
class decimal128_t;
} //namespace decimal
} //namespace boost
and also 3 similar but non-compliant types with improved runtime performance:
namespace boost {
namespace decimal {
class decimal_fast32_t;
class decimal_fast64_t;
class decimal_fast128_t;
} //namespace decimal
} //namespace boost
These types operate like built-in floating point types.
They have their own implementations of the Standard-Library functions
(e.g. like those found in <cmath>, <charconv>, <cstdlib>, etc.).
The entire library can be conveniently included with #include <boost/decimal.hpp>
Using the decimal types is straightforward and can be learned by example. Their usage closely resembles that of built-in binary floating point types by design.
Full Documentation
The complete documentation can be found at: https://www.boost.org/doc/libs/develop/libs/decimal/doc/html/overview.html
Related Skills
node-connect
334.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.2kCommit, push, and open a PR
