看下面的两段代码,告诉我为什么答案会有很大差异。
#include<stdio.h>
int main() {
float a = 0.9;
if(a<0.9)
printf("hi"); // This will be the answer
else
printf("bye");
return 0;
}
如果我们将0.9更改为0.8,那么else语句会被打印出来:
#include<stdio.h>
int main() {
float a = 0.8;
if(a<0.8)
printf("hi");
else
printf("bye");//this will be the answer
return 0;
}
那么为什么只改变一个数字就会导致输出结果改变呢?