Search code examples
cprintfmbed

Why floating point formats in Mbed Studio don't work?


float lgt = light.read();
if(isnan(lgt)){
    printf("Failed to read light!");
}
 else{
    printf("%f\n",lgt);
}

Second printf always print '%f' in the console instead of 'lgt' value. Why could this happen? I'm using Mbed Studio.


Solution

  • Why floating point formats in Mbed Studio don't work?

    Because you are compiling your program with newlib nano version that does not support floating point format in printf family.