Libfixmath
{{Primary sources|date=January 2023}}
{{lowercase|title=libfixmath}}
{{Infobox software
| name = libfixmath
| developer = Ben Brewer
| latest_release_version = r64
| latest_release_date = {{Start date and age|2012|02|02}}
| programming language = C99
| operating_system = Cross-platform
| genre = fixed-point math library
| license = MIT
| website =
}}
libfixmath is a platform-independent fixed-point math library aimed at developers wanting to perform fast non-integer math on platforms lacking a (or with a low performance) FPU. It offers developers a similar interface to the standard math.h functions for use on Q16.16 fixed-point numbers. libfixmath has no external dependencies other than stdint.h and a compiler which supports 64-bit integer arithmetic (such as GCC).{{cite web|url=https://github.com/PetteriAimonen/libfixmath|title=libfixmath Project Page|website=GitHub }}
Conditional compilation options exist to remove the requirement for a 64-bit capable compiler as many compilers for microcontrollers and DSPs do not support 64-bit arithmetic.{{cite web|url=https://code.google.com/p/libfixmath/issues/detail?id=4|title=64-bit Compiler Support Issues}}
History
libfixmath was developed by Ben Brewer and first released publicly as part of the Dingoo SDK.{{cite web|url=https://code.google.com/p/dingoo-sdk|title=Dingoo SDK Project Page}} It has since been used to implement a software 3D graphics library called FGL.{{cite web|url=https://code.google.com/p/fgl|title=FGL Flatmush/Fixed-Point Graphics Library Project Page}}
Q16.16 functions
class="wikitable" | |
Name | Description |
---|---|
fix16_acos | inverse cosine |
fix16_asin | inverse sine |
fix16_atan | one-parameter inverse tangent |
fix16_atan2 | two-parameter inverse tangent |
fix16_cos | cosine |
fix16_exp | exponential function |
fix16_sin | sine |
fix16_sqrt | square root |
fix16_tan | tangent |
fix16_mul | multiplication |
fix16_div | division |
fix16_sadd | saturated addition |
fix16_smul | saturated multiplication |
fix16_sdiv | saturated division |
Other functions
Performance
For the most intensive function (atan2) benchmark results show the following results:
class="wikitable" | |
Name | Time Compared to Float |
---|---|
ARM Cortex-M0 | 26.3% |
Marvell PXA270 (ARM) @ 312 MHz | 58.45% |
Intel T5500 | 120% |
Intel Atom N280 | 141% |
Note: These results were calculated using fixtest with caching optimizations turned off.{{cite web|url=https://code.google.com/p/libfixmath/downloads/detail?name=fixtest_r16.zip|title=fixtest Download Page}}
Licensing
libfixmath is released under the MIT License, a permissive free software licence, and is free software.
See also
{{Portal|Free Software}}
References
{{Reflist}}
External links
- [https://github.com/PetteriAimonen/libfixmath Project Page]
- [http://groups.google.com/group/libfixmath Group Page/Mailing List]
Category:C (programming language) libraries