W
weiliu
Unregistered / Unconfirmed
GUEST, unregistred user!
大家试试以下的简单程序,当max_float_num的值为3.1e4时完全正常,而此值为4.1e4时为何像死机一样计算不出来了?
var
float_num,float_operator,max_float_num:single;
begin
float_num:=1e-3;
float_operator:=float_num;
max_float_num:=3.1e4;
while float_num-max_float_num<1e-6 do
begin
float_num:=(float_num+float_operator+float_operator-float_operator)*float_operator/float_operator;
end;
showmessage(floattostr(float_num));
end;
var
float_num,float_operator,max_float_num:single;
begin
float_num:=1e-3;
float_operator:=float_num;
max_float_num:=3.1e4;
while float_num-max_float_num<1e-6 do
begin
float_num:=(float_num+float_operator+float_operator-float_operator)*float_operator/float_operator;
end;
showmessage(floattostr(float_num));
end;