W
wanglong0
Unregistered / Unconfirmed
GUEST, unregistred user!
按理说,下面2个结算结果应该是一致的,但是却不是:
procedure TForm1.Button1Click(Sender: TObject);
var
cc: currency;
cc2:currency;
begin
cc2 := 5.85;
cc := strtocurr(Format('%.1f', [cc2]));
edit1.text := Format('%.2f', [cc]);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
cc: currency;
begin
cc := strtocurr(Format('%.1f', [5.85]));
edit1.text := Format('%.2f', [cc]);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
cc: currency;
cc2:currency;
begin
cc2 := 5.85;
cc := strtocurr(Format('%.1f', [cc2]));
edit1.text := Format('%.2f', [cc]);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
cc: currency;
begin
cc := strtocurr(Format('%.1f', [5.85]));
edit1.text := Format('%.2f', [cc]);
end;