HELP!!!在linux 中如何用long double?
我要用搞精度的数据.
我写
long double d1= 1.0e-400;
long double d2 =1.0e-401;
double d = d1/d2;
printf("d = %f",d);
为什么显示是NAN(not a number)???请大家指点
问题点数:0、回复次数:4Top
1 楼longfellow()回复于 2004-08-02 01:14:51 得分 0
没人知道吗?Top
2 楼yjf7888(seeking a place 找工作了location:Chengdu)回复于 2004-08-02 09:44:19 得分 0
long double d1= 1.0e-400L;
long double d2 =1.0e-401L;
double d = d1/d2;
printf("d = %lf",d);
不知道是不是这里的问题?
Top
3 楼pacman2000(pacman)(影子传说)回复于 2004-08-02 09:53:01 得分 0
呵呵,long double 也不能表示10的负401次方啊,太小了,基本上就是0了。Top
4 楼kpld8888(kpld)回复于 2004-08-02 12:40:49 得分 0
Double precision values with double type have 8 bytes. The format is similar to the float format except that it has an 11-bit excess-1023 exponent and a 52-bit mantissa, plus the implied high-order 1 bit. This format gives a range of approximately 1.7E–308 to 1.7E+308 for type double.
MSDN的解释Top




