A constexpr
enhanced, real numbers, C++ library with support for fixed point types satisfying the LiteralType named requirement.
Why yet another fixed-point data type and math library?
Reasons:
- For a
constexpr
enhanced fixed-point type. - For
constexpr
enhancedcmath
functions at least for the fixed-point type. - For that fixed-point type to satisfy the
LiteralType
named requirement. - To get this code out from another project it had been in (PlayRho), and in to its own project.
- Having a project whose consumption by another project of mine could be more readily tested.
This is experimental code that's a work in progress.
To use this within your own project...
Add the following to your CMake configuration where you replace your_target
with your project's target name:
include(FetchContent)
FetchContent_Declare(
realnumb
GIT_REPOSITORY https://github.com/louis-langholtz/realnumb
GIT_TAG main # Hash or tag or branch name
)
FetchContent_MakeAvailable(realnumb)
target_link_libraries(your_target realnumb)
Like for development...
Configure and build:
cmake -S realnumb -B realnumb_build -DREALNUMB_BUILD_UNITTEST=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DREALNUMB_INSTALL=ON
cmake --build realnumb_build --config Release
Then, for a local install:
cmake --install realnumb_build --prefix realnumb_install
- Fixed point arithmetic on WikiPedia.
- PlayRho issue No external fixed-point implementation supported.
- Compositional Numeric Library, a C++ library of fixed-precision numeric classes.
- libfixmath archived at code.google.com and libfixmath at github. Neither of these appear to have
constexpr
support, nor support for anything but Q16.16 format, nor active maintenance.