C++ fixed point library?

uj2 picture uj2 · May 31, 2010 · Viewed 33.6k times · Source

I am looking for a free C++ fixed point library (Mainly for use with embedded devices, not for arbitrary precision math). Basically, the requirements are:

  • No unnecessary runtime overhead: whatever can be done at compile time, should be done at compile time.
  • Ability to transparently switch code between fixed and floating point, with no inherent overhead.
  • Fixed point math functions. There's no much point using fixed point if you need to cast back and forth in order to take a square root.
  • Small footprint.

Any suggestions?

Answer

flatmush picture flatmush · Mar 2, 2011

There is an open-source fixed point math library project which can be found by following the links below:

It is a C static library with a C++ class interface for C++ users, it implements the following functionality: Trig. Functions: sin, cos, tan, asin, acos, atan, atan2 Saturated Arithmetic: sadd, ssub, smul, sdiv Other Functions: sqrt, exp

It only supports 16.16 fixed-point datatype.

It is an actively developed open-source project (looking for interested developers).