|
就是下面这段,根据一些给出的数,算出另一个数,如果delphi执行要1秒的话,laz要2秒,我觉得这差的太多了
我电脑配置:intel E3400@2G,sdd 硬盘
不知道是不是我的电脑配置低了呢,
另外,还有个问题,就是下面程序里计算部分的这两句
res := (n*h);
res := res * 1000000;
必须分开写才行,如果写在一起,
res := (n*h*1000000);
得到的结果就是错的,laz得到的结果少,而delphi一个结果也得不到,这是为什么呢
附件里是两个工程,分别用delphi2007和laz最新的1.4编译
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
h :Word;
m : Word;
n :Word;
r : Word;
d : Word;
o : Word;
t_str : AnsiString;
res : Currency;
v_start : Currency;
v_end : Currency;
begin
//dis_fs_f;
Form1.speedbutton1.Enabled := False;
h := StrToInt(Form1.Edit1.Text); //h = 12
v_start := StrToFloat(Form1.Edit3.Text); //v_start = 44090
v_end := StrToFloat(Form1.Edit4.Text);//v_end = 44110
for m:= StrToInt(Form1.Edit2.Text) to h do //m = 12
for n := 2 to 432 do
begin
for r := 2 to 7 do
begin
for d := 2 to 255 do
begin
for o := 0 to 1 do
begin
//t_str := 'H=' + IntToStr(h) + '; ';
res := (n*h);
res := res * 1000000;
//res := h/m;
res := res /(m*r);
//res := res/r;
if Form1.CheckBox1.Checked then
res := res/(256*(2*d + o))
else
res := res/(32*(2*d + o));
if Form1.RadioButton2.Checked then
res := res/(2*(2*d + o));
//res := res/(2*d + o);
if (res >= v_start) and (res <= v_end) then
begin
t_str :='M=' + IntToStr(m) + '; ';
t_str :=t_str + 'N=' + IntToStr(n) + '; ';
t_str :=t_str + 'R=' + IntToStr(r) + '; ';
t_str :=t_str + 'DIV=' + IntToStr(d) + '; ';
t_str :=t_str + 'ODD=' + IntToStr(o) + '; ';
t_str := t_str + FloatToStrF(res,ffNumber,11,5);
Memo1.Lines.Add(t_str);
end;
end;
end;
end;
end;
form1.speedbutton1.Enabled := True;
end;
|
|