为什么 Mbed Studio 中的浮点格式不起作用?
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);
}
第二个 printf 始终在控制台中打印“%f”而不是 'lgt' 值。为什么会这样?我正在使用 Mbed Studio。
Why floating point formats in Mbed Studio don't work?
因为您正在使用 printf
系列中不支持浮点格式的 newlib nano 版本编译您的程序。
float lgt = light.read();
if(isnan(lgt)){
printf("Failed to read light!");
}
else{
printf("%f\n",lgt);
}
第二个 printf 始终在控制台中打印“%f”而不是 'lgt' 值。为什么会这样?我正在使用 Mbed Studio。
Why floating point formats in Mbed Studio don't work?
因为您正在使用 printf
系列中不支持浮点格式的 newlib nano 版本编译您的程序。