How to use floating point with printf
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-04-21 4:40 AM
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!
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:32 AM
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...
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
A complex system designed from scratch never works and cannot be patched up to make it work.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:32 AM
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
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
A complex system designed from scratch never works and cannot be patched up to make it work.
