blob: 8a9c462c767dd5e0e01f098311aeebf25cb86f27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# Accuracy
The images below compare the accuracy (versus the real result) of:
* `fpm` (the `Q8.24` and `Q16.16` types)
* [libfixmath](https://github.com/PetteriAimonen/libfixmath) (`fix16`), an alternative C library.
The accuracy of `Q24.8` was not shown since it was wildly inaccurate. It's advised to use at least 16 bits of fraction for reasonable accuracy for trigonometric operations (as in these tests).
Plotted is the relative error (`(result - real) / real`). Closer to 0 is better.
## Trigonometry functions



The results show that `fpm`'s trigonometric functions have better worst-case accuracy than `libfixmath`, although the latter has better overall accuracy except for certain domains where it has very large error.
## Inverse trigonometry functions




The results show that `fpm`'s inverse trigonometric functions have better accuracy then `libfixmath`.
## Power functions








The results show that for those power functions that `libfixmath` supports, `fpm` is less accurate. However, the relative error of all power functions is well below 0.1% in the tested cases, and even less some functions.
|