# include <stdio.h>
int main(void)
{
const float VAL=3.14159;
float b;
scanf("%f",&b);
while(1)
{
if(b==VAL)
printf("yes\n");
else
printf("no\n");
scanf("%f",&b);
}
return 0;
}
我知道浮点数在内存中存储是一个近似值,比如7.000000可能是6.999999.那么如何用浮点数做判断呢,如果我始终重复输入3.14159,上面的可不可能会有一次打印出no呢?