909 B
909 B
ratio library
Header-only, constexpr library providing exact representation for rational numbers.
Relative to std::ratio:
- Uses
constexprinstead of creating new types. This means it can be used seamlessly at runtime. - Supports a few more arithmetic operations, for example exponentiation to integer powers.
- Provides constexpr conversion to fixed-capacity strings (using xo-flatstring)
- Provides concept support (with c++20)
- Requires modern (c++17) support to achieve this
Getting Started
install dependencies
- github/Rconybea/xo-cmake cmake macros
- github/Rconybea/xo-flatstring fixed-capacity strings
build + install
$ cd xo-ratio
$ PREFIX=/usr/local # for example
$ BUILDDIR=.build # for example
$ make ${BUILDDIR}
$ cmake -DCMAKE_PREFIX_PATH=${PREFIX} -B ${BUILDDIR}