A C++ library providing fixed-precision numeric types for safer, simpler, and more efficient arithmetic in constrained environments.
CNL (Compositional Numeric Library) is a C++ library that provides fixed-precision numeric classes to enhance integers for safer, simpler, and more efficient arithmetic. It solves problems in environments where floating-point units are absent or costly, or where precision is critical, such as in finance, simulations, and DSP applications.
C++ developers working in compute-constrained or energy-intensive environments, such as embedded systems, simulations, machine learning, DSP, and financial applications where precise and efficient arithmetic is essential.
Developers choose CNL for its compositional design that minimizes performance and precision loss, its header-only ease of integration, and its focus on safety and efficiency in arithmetic operations without relying on floating-point hardware.
A Compositional Numeric Library for C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides integer-backed real number approximations that minimize performance loss, ideal for environments without floating-point units, as emphasized in its target applications like embedded systems.
Easy to integrate without complex build dependencies; you can simply include headers, as shown in the instructions with examples like adding the include directory directly.
Built for C++20 with a version 1.x supporting C++11, ensuring forward compatibility and use across various codebases, as detailed in the requirements section.
Continuously tested on GCC, Clang, Visual Studio, and multiple standard libraries, providing robust support across different toolchains, as listed in the tested systems.
Compared to alternatives like fpm, CNL lacks a high quantity of mathematical functions, focusing more on arithmetic types, as acknowledged in the alternatives section.
Running the test suite requires Conan and specific CMake configurations, which can be cumbersome for quick validation, as seen in the multi-step build instructions.
Requires familiarity with fixed-point arithmetic concepts, which may pose a learning curve for developers new to this domain, despite the compositional design.