The code is distributed under the Boost Software License which isn’t viral as some others are said to be. (This is not part of Boost. The author just likes their open-source license.)
The integer and decimal types began their lives as C++ equivalents of SQL’s NUMERIC and DECIMAL types for use in a database access library that the author is working on, and are deliberately written to require no language or standard library features beyond C++11; the rational number began its life as part of a Technical Specification (“TS”, a kind of warning about possible future standardization) that WG21’s numerics study group was once (but is no longer) working on (P1889R1 §7).
(At present, the rational class doesn’t require anything past C++11 either, but a possible future version that has NaNs and infinities would use C++20’s spaceship operator for comparisons.)
The decimal class uses integer as a type in which it can return very large integers, and rational uses integer internally for its numerator and denominator to help guard against overflow, so the author decided to put all three types into a single library.
The code has been tested with GCC (__GNUC__ == 10,
__GNUC_MINOR__ == 2) on Linux, and with a Microsoft compiler
(_MSC_VER == 1928) on Windows. Both default to
The source code is provided in A ZIP archive which contains: