首页上一页 1 下一页尾页 1 条记录 1/1页
float和double 的问题。
发表在C语言图书答疑
2013-07-17
是否精华
是
否
版块置顶:
是
否
#include<stdio.h>
main()
{
double x;
x=2222222222.222226666;
printf("x=%f\n",x);
}
x=2222222222.222227
Press any key to continue
#include<stdio.h>
main()
{
float x;
x=22222.678;
printf("x=%f\n",x);
}
x=22222.677734
Press any key to continue
问①,在我这台电脑用这个软件的只“针对”上述这个程序,这个结果,即“此刻”float 和 double 的有效数分别是多少呢?(注意:不要多想。就“只针对”此刻。即上述我给出的那个程序的那个结果的“此刻”)
②,书中说 float 的有效数是 6~7位
Double 的有效数是 15~16位。 究竟是多少位和电脑有关还是和软件有关?
main()
{
double x;
x=2222222222.222226666;
printf("x=%f\n",x);
}
x=2222222222.222227
Press any key to continue
#include<stdio.h>
main()
{
float x;
x=22222.678;
printf("x=%f\n",x);
}
x=22222.677734
Press any key to continue
问①,在我这台电脑用这个软件的只“针对”上述这个程序,这个结果,即“此刻”float 和 double 的有效数分别是多少呢?(注意:不要多想。就“只针对”此刻。即上述我给出的那个程序的那个结果的“此刻”)
②,书中说 float 的有效数是 6~7位
Double 的有效数是 15~16位。 究竟是多少位和电脑有关还是和软件有关?