For faster navigation, this Iframe is preloading the Wikiwand page for libfixmath.

libfixmath

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: "Libfixmath" – news · newspapers · books · scholar · JSTOR (January 2023) (Learn how and when to remove this message)
libfixmath
Developer(s)Ben Brewer
Stable release
r64 / February 2, 2012; 12 years ago (2012-02-02)
Repository
Written inC99
Operating systemCross-platform
Typefixed-point math library
LicenseMIT
Websitecode.google.com/p/libfixmath Edit this on Wikidata

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).[1] 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.[2]

History

[edit]

libfixmath was developed by Ben Brewer and first released publicly as part of the Dingoo SDK.[3] It has since been used to implement a software 3D graphics library called FGL.[4]

Q16.16 functions

[edit]
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

[edit]
Name Description
fix16_to_dbl Convert Q16.16 to a double
fix16_to_float Convert Q16.16 to a float
fix16_to_int Convert Q16.16 to an integer
fix16_from_dbl Convert double to a Q16.16
fix16_from_float Convert float to a Q16.16
fix16_from_int Convert integer to a Q16.16

Performance

[edit]

For the most intensive function (atan2) benchmark results show the following results:

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.[5]

Licensing

[edit]

libfixmath is released under the MIT License, a permissive free software licence, and is free software.

See also

[edit]

References

[edit]
  1. ^ "libfixmath Project Page".
  2. ^ "64-bit Compiler Support Issues".
  3. ^ "Dingoo SDK Project Page".
  4. ^ "FGL Flatmush/Fixed-Point Graphics Library Project Page".
  5. ^ "fixtest Download Page".
[edit]
{{bottomLinkPreText}} {{bottomLinkText}}
libfixmath
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 ๐ŸŽ‰! the new version arrives on September 1st! Don't want to wait?