請解釋輸出不同情況float和double輸出
#include<stdio.h>
int main()
{
float a=5.9; //a=0.9
if (a==5.9)
printf("Equal");
else if (a<5.9)
printf("Less than");
else
printf("Greater than");
return 0;
}
當一個是5.9的輸出「大於」,當是0.9輸出爲「小於」。爲什麼?
這一切都在這裏:http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html – 2013-03-05 01:03:31
你知道如何寫基數2的5.9嗎? – perreal 2013-03-05 01:03:34
浮點數101 – 2013-03-05 01:04:31