float值的范围是3.4e-38到3.4e+38。因此,浮点型变量不应该存储负值。但是浮点型变量存储的是负值。请给我解释一下。
#include<iostream.h>
void main()
{ float ab=-3.456;
cout<<ab; }输出:
-3.456发布于 2014-10-28 14:33:40
发布于 2014-10-28 15:13:46
浮点数基本上由三个数字组成
significant * base ^ exponent有效部分和指数部分都可以有单独的符号。所以实际的浮动范围是:
float 32 bits -3.4E+38 to +3.4E+38 about 7 decimal digitshttps://stackoverflow.com/questions/26602107
复制相似问题