I get errors like MISRA when I use the "% f" specifier for snprintf with a parameter of type float .
According to my research, MISRA is correct because "% f" expects a double .
Is there a specifier or modifier with a floating point that will use a parameter of type float , not double ?
I am working on an embedded system and do not want to convert from a 32-bit float to a 64-bit double in order to satisfy the snprintf function. The code prints to the debug / console port, and this is the only place where the conversion takes place.
For those of you who have sample code:
// This section is for those C++ purists and it fulfills the C++ tag.
All my research on SO and Web is about printing floating point values, and not about which qualifiers, the float parameter will be needed so as not to advance to double .
I am using the IAR Embedded Workbench compiler for the ARM7TDMI processor.
source share