[En-Nut-Discussion] Fixed-point library

Harald Kipp harald.kipp at egnite.de
Tue Sep 24 11:08:46 CEST 2013

Hi all,

Almost no embedded application I wrote so far required floating point
values. It is usually sufficient to scale ranges to integer values, e.g.
2075 representing 20.75.

But now I need trigonometric functions, which are not available for
scaled integers, right? Actually it may be possible to write my own, but
I'd prefer a more general solution.

ISO/IEC TR18037 specifies extensions for embedded processors, including
fixed-point arithmetic and it looks like that GCC has been following
this track for some time. At least fixed point types seem to be included
since GCC 4.7. That looks promising.

Unfortunately I'm unable to figure out, which embedded C libraries offer
mathematical functions for these new fixed-point values.

Earlier I considered http://en.wikipedia.org/wiki/Libfixmath, which is
published under MIT license. But it defines its own types. The
disadvantage of such an approach is, that you have to call functions to
apply elementary arithmetic operations on them or directly assign
constants. Coding expressions like 'a = b + c * d' won't be possible.

I'd very much appreciate, when members of this list will share their
experience, if there are any.



More information about the En-Nut-Discussion mailing list