Boost's multiprecision to emulate low-accuracy fast floats

195 Views Asked by At

I have an stm32-F1 processor that is very slow with float operations and I have some libraries from an F7 processor that uses a lot of floats. I would like to use this libraries on my poor F1 so I was thinking of a way to make as less tweaks as I can on the code and emulate floats with a same interface but with an underling integer type.It's important to note that I only need 7 digits of accuracy (numbers between 0.001 and 4094.999 that's why I guess something like typedef number<cpp_dec_float<7> > fixed7; would work in my case faster than floats. Is boost's multiprescision good enough for that ? Do you have any other suggestions? should I make my own arithmetic type?

1

There are 1 best solutions below

0
On BEST ANSWER

I found a solution after all. Τhis numeric system is excellent for my purpose and a little simpler to use as multiprescision is based on having higher accuracy than normal c++ but I just want less precision. Here is John's MC Farlane numeric types