Question
atof convension error
Posted on December 15, 2015 at 15:44
Hi clive,
I encounter a problem in converting float string array to float then back to float string array.I have this array acValue = ''1000.1'';then float fValue = atof(acValue);then what I got in fValue is 1000.0997when I convert it again to string, for examplesprintf(acValue, ''%f'', fValue);acValue became now 1000.0997Do you have any idea why this happen?I tried many ways to trick it, like strtok the string to two,then convert the whole number and floating number.converting the float alone will result to 0.1, but when I add 1000 to it, it now becomes 1000.0997Im using STM32F103, IAR EWARM and NORTi for my OS.Regards,Mike #atof-convertion-error-float