Performance
The image below shows the approximate performance of:
fpm(theQ16.16type)- libfixmath (
fix16), an alternative C library (see notes). - Compositional Numeric Library (
CNL), an experimental library that is being developed in C++’s SG14. - native FPU operations (
floatanddouble).
The graph below plots the average number of nanoseconds a single operation takes: lower is better. The data was collected with Google Benchmark on an Intel Core i7-5820K, 3.3GHz.

The results show the following:
- Compared to
libfixmath, the performance offpmis at least as good, except forexp, where it’s considerably slower. - Compared to CNL,
fpmonly matches the performance forsqrt. However, CNL does not support the majority of benchmarked functions. - Compared to native single-precision floating-point operations,
fpmis slower by up to an order of magnitude for most functions, except for the basicadd,suband several power or trigonometry functions, where it is faster.
Notes
For a fair comparison, libfixmath was compiled with FIXMATH_NO_CACHE.
It should also have been compiled with FIXMATH_NO_OVERFLOW (since fpm does not detect overflow), but libfixmath failed to compile with that option.