这是由语言定义的吗?是否有定义的最大值?在不同的浏览器中是不同的?
我写了以下程序:
#include<stdio.h>
int main(void)
{
float f;
printf("\nInput a floating-point no.: ");
scanf("%f",&f);
printf("\nOutput: %f\n",f);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在Ubuntu上并使用GCC编译上述程序.这是我想要查询的示例运行和输出:
Input a floating-point no.: 125.1
Output: 125.099998
Run Code Online (Sandbox Code Playgroud)
为什么精度会发生变化?