cancel
Showing results for 
Search instead for 
Did you mean: 

How to use floating point with printf

philipgillespie
Associate II
Posted on April 21, 2011 at 13:40

How to use floating point with printf

#floating-point---just-say-no! #floating-point---just-say-no!
2 REPLIES 2
Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:32

Since Floating Point requires very significantly more resources (memory space, execution time, etc) than integer maths - especially on a chip like the STM32 with no hardware FPU - it is often best avoided on (small) microcontrollers.

For this reason, many (most?) embedded toolsets disable floating point by default.

Therefore, the first thing you really need to ask yourself is, ''do I really need floating point?''

 

 

eg, instead of 

float volts;

volts = 1.6483; you could have:

int millivolts;

millivolts = 16483;

Otherwise, you are going to have to consult your Raisonance manuals to find out about their support for floating point...

Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:32

Floating point also raises a number of issues about precision...

Take a look at, for example: 

http://www.guidogybels.eu/fpart1.html