AnsweredAssumed Answered

floating point printf / sprintf in 3.8.1

Question asked by keith tang on Aug 16, 2012
Latest reply on Sep 24, 2012 by keith tang

I used to be able to compile and run perfectly the following simple C code in MQX 3.8:

float f = (float)temperature / 32.0 * 0.125;

printf("temp: %3.1f\n", f);

 

However it hangs in MQX3.8.1, which I had to modify to work using the div_t data type:

div_t n = div(f,1);

printf("temp: %02d.%d\n", n.quot, n.rem);

 

The same happens to the sprintf() function.

 

I am not sure, but I have a feeling it has to do with the PSP_HAS_FPU being enabled?

 

Anyone can help?

Outcomes