能解释一下float 溢出吗?
#include <iostream.h> //包含iostream.h头文件
main()
{
//float型溢出
float x=3.5e14;
cout<<"x="<<x<<endl;
cout<<"x*x="<<x*x<<endl;
cout<<"x*x*x="<<x*x*x<<endl;
}
运行之后结果是这样的:
x=3.5e+014
x*x=1.225e+029
x*x*x=1.#INF
为什么 会出现 x*x*x=1.#INF?能解释一下 溢出是怎么回事吗?哪溢出了?float的上界可是比这个大啊!我用的是VC++!