A cross-platform C library implementing Q16.16 fixed-point arithmetic for systems without floating-point hardware.
Libfixmath is a cross-platform C library that implements fixed-point mathematics using Q16.16 format. It provides arithmetic, trigonometric, and other mathematical operations for systems lacking floating-point hardware, offering deterministic performance and memory usage. The library solves the problem of performing precise calculations on embedded devices and microcontrollers where floating-point operations are too slow or unavailable.
Embedded systems developers, microcontroller programmers, and anyone working on resource-constrained platforms that need predictable mathematical operations without floating-point hardware.
Developers choose Libfixmath for its portability across different compilers and platforms, configurable optimizations for specific hardware constraints, and reliable fixed-point arithmetic that avoids the overhead and unpredictability of software floating-point emulation.
Cross Platform Fixed Point Maths Library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The library works on various compilers and platforms, with configurable options like FIXMATH_NO_64BIT for systems without 64-bit support, as detailed in the README.
It provides predictable performance and memory usage using fixed-point arithmetic, avoiding the overhead and unpredictability of software floating-point emulation in embedded systems.
Compile-time options such as FIXMATH_FAST_SIN and FIXMATH_OPTIMIZE_8BIT allow trade-offs between speed and accuracy tailored to specific hardware, as explained in the options section.
Designed for microcontrollers with features like optional caches and overflow handling, making it suitable for resource-constrained environments where floating-point hardware is unavailable.
The README explicitly states 'Not actively maintained, pull requests welcome,' indicating risks from unaddressed bugs and lack of future updates or support.
It only implements Q16.16 fixed-point format, lacking support for other formats (e.g., Q8.8 or Q32.32), which limits flexibility for varying precision needs in different applications.
Enabling caches for exponents and trigonometry uses significant static memory (32KB and 80KB), which can be prohibitive for extremely memory-constrained embedded systems, as noted in the FIXMATH_NO_CACHE option.
Multiple compile-time definitions like FIXMATH_NO_HARD_DIVISION and FIXMATH_NO_ROUNDING require careful setup and hardware understanding, increasing initial integration effort and potential for errors.