/**
2.9999999999999996000
2
Press any key to continue . . .
*/
int main()
{
double a=3.3;
double b=1.1;
int c;
printf("%.19f\n", a/b);
c=a/b;
cout<<c<<endl;
system("pause");
return 0;
}作者: 秋燕子_児 时间: 2009-11-3 02:04
谢谢.可是怎么解释发现如果a=2.2,4.4,8.8,17.6...等1.1的2的次幂的倍数时
输出为2,4,8,16...?作者: 依ing梦 时间: 2009-11-3 02:04
if you really want to know how things work inside a computer, you need to know how numbers are represented in the memory.
IEEE standard for floating-point numbers is a good starting point.
I think it is IEEE 754.作者: 爱情tp乞丐 时间: 2009-11-3 02:04
应该是浮点数的存储形式作者: 風過aiq無痕 时间: 2009-11-3 02:04
谢谢各位!