Skip to content

Amixa Technical Blog

Month: July 2017

sprintf or printf do not output float variables correctly

Have you run into situation under the MPLAB IDE where you are trying to output variables, but even though you have the format correct, a float variable outputs with a .0 value? Example (from somewhere else in code) AIRTEMP=751 ==== float adjustedtemp= 0.0; adjustedtemp= (AIRTEMP + 5)/10; printf(“Air Temp: %5.2f \r\n”, adjustedtemp); the result looks…

Read article