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 permissive 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 library features past 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.)
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) and provides conversions to and from both integer and decimal, 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
| That statement is true about an older version; but I’ve made a few changes recently that still haven’t been thoroughly tested. All the code compiles cleanly. |
The source code is provided in a ZIP archive which contains:
All the code can be compiled with any C++ implementation that conforms at least to
C++11. Although
it’s not otherwise documented, move assignment and all the