Like explain in following thread : wavecom.profileo.com/modules/mov … ight=float
We can’t use printf("%f",myFloat) with GCC …
Do you know why ? and where the problem/restriction is explained ?
Is there a good workaround ?
Is there a schedule bug fixe ?
The problem seems to be there both with GCC 4 and GCC 3 … Do you confirm ?
If you are using ARM compiler to compile your applicaiton, then you can USE the TRACE () macro to print the floating point value. You can use the following statement :
TRACE((1,“The value of slop is %f”,slop));
There is no limiation in the usage of %f format string under ARM compiler.
If you are using GCC compiler to compile your applcation, then you have to use some workaround to print the floating point value. This is because, in GCC if you use the %f format specifier, the module crashes. To circumvent, this problem, you should convert your floating point value to a string and then print the string value. For instance,
ascii buffer[20];
s16 mantissa, modified_value;
wm_memset(buffer,’\0’,20);
modified_value = (s16)slop *1000; //assuming slop contains
//the
// floating point value.
mantissa = modified_value - (s16) slop;
wm_sprintf(buffer,"%d.%03d",(s16)slop,mantissa);
TRACE((1,buffer));
Please note that the above code will provide you with 3 digits of precision after the decimal point. You can increase the precision by increasing the multiplier value for “slop” variable.