double 的精確度
(高顯忠, sjgau4311@gmail.com, 2011-07-19 20:51)
1樓
#if 0
x= 9012334810160984.000,
y= 9012334810160984.000
請按任意鍵繼續 . . .
#endif
// ----------------------------------------------
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// ----------------------------------------------
int main()
{
//
double x, y;
x= 10;
y= x + 1;
while (y > x) {
x= x * 1.001;
y= x + 1;
}
printf("\n x= %.3lf, \n y= %.3lf \n", x, y);
system("pause");
return 0;
}// end of main()