fixed_point Numerics Library
Notice: This library is in maintenance mode. Pull requests with fixes and enhancements are gratefully accepted, but no new features are planned. Please consider switching to CNL, the successor to fixed_point for many new features and improvements.
The fixed_point library provides a header-only C++11 API for approximating real numbers using binary fixed-point arithmetic. It forms the reference implementation of a standard library proposal presented in paper, P0037 and is developed as part of study groups, SG14 and SG6.
The library is hosted on GitHub:
$ git clone https://github.com/johnmcfarlane/fixed_point.git
The API is exposed through headers in the include directory. Add this to your system header list and include, e.g.:
Tests and Benchmarks
- G++ 5.4
- CMake 3.2
- Boost - facilitates multiprecision support
- Doxygen - generates documentation in the doc/gh-pages directory
- pandoc - generates proposal papers
For a list of configuration options:
$ cmake -LH
To build everything:
$ cmake -DCMAKE_BUILD_TYPE=Release $ make
To disable exception handling (incompatible with Boost 1.55 or lower), add
-DEXCEPTIONS=OFF to the
$ cmake -DCMAKE_BUILD_TYPE=Release -DEXCEPTIONS=OFF $ make
To run tests:
$ cmake -DCMAKE_BUILD_TYPE=Release $ make fp_test $ ./fp_test
To run benchmarks:
$ cmake -DCMAKE_BUILD_TYPE=Release $ make fp_benchmark $ ./fp_benchmark
To profile benchmarks:
Build with frame pointers included:
$ cmake -DCMAKE_BUILD_TYPE=Release -DPROFILE=ON $ make fp_benchmark $ ./fp_benchmark
$ perf record -g ./fp_benchmark $ perf report -g 'graph,0.5,caller'
$ cmake -DCMAKE_BUILD_TYPE=Release $ make $ sudo make install
Tested on AppVeyor and on Windows 10 Professional with CMake 3.8.0. Requires:
- MSBuild 15.0 (VS 2017)
- CMake 3.8.0
To build vs/Release/fp_test.exe and vs/Release/fp_benchmark.exe:
cmake -G "Visual Studio 15 2017" . MSBuild.exe /m fixed_point.sln /p:Configuration=Release
For 64-bit builds, append
Win64 to the
-G option above:
cmake -G "Visual Studio 15 2017 Win64" .
Note that fp_benchmark is unlikely to produce valid results due to missing
To clean the project files:
git clean -Xdff .
(Use with caution!)
- latest draft of C++ Standard Library proposal, P0037
- position paper illustrating the compositonal approach, P0554
- forum of Study Group 14
All feedback greatly appreciated.