Water-E:
晕了,执行乘法操作居然比判断相等还快,是不是我的机器吃春药了
[阅读: 633] 2004-10-12 06:02:53
var
f,f1:single;
// f,f1:double;
i,c:integer;
begin
f1:= 1.000001251;
f := Random(5);
c:= GetTickCount ;
for i := 0 to 1000000 do
f:=f*f1;
//if f=f1 then Continue;
Caption := inttostr(GetTickCount -c);
Label1.Caption := FloatToStr(f);
single和double执行时间都是16或0,按说上面的代码编译器应该没有优化掉才是
嘿嘿