This repository contains a fork of Fixed Point Math Library for C improved with some additional functionalities.
Features of original library:
- Fixed point math library
- Requires a fairly modern C compiler with
uint32_t
anduint64_t
- 32-bit and 64-bit precision support (for compilers with
__int128_t
extensions likegcc
) - Arbitrary precision point (e.g. 24.8 or 32.32)
- Pure header-only
- Pure integer-only (suitable for kernels, embedded CPUs, etc)
This version features also
- Floating point free conversion from strings to
fpt
values - Conversion from
fpt
to string returns string size - Normalized conversion between
fpt
andint
- Over/underflow detection and handling
- And other minor improvements...
Once the decimal point position is chosen, it is set for the whole project. Normalization is useful, when some of the variables are of the different order of magnitude than others. The idea here is to scale the variables so they are represented by a variable with approximately unary order of magnitude, and then, when the calculations are finished, to scale back to original form.
It is the developer duty to keep track of which variable has which normalization factor applied. Usefulness of such approach was proven for cases such as discrete adaptive control system implementation or solving of a linear equation systems via matrix decomposition.
This modified library is released under the same license as the original one, ie. BSD-2.
LICENSE
file features original authors copyrights disclosures.