K
kokusan
Unregistered / Unconfirmed
GUEST, unregistred user!
试一试Extended类型吧。运行一下下面的程序,可知它的分辨率是足够的;可能的
问题是跨平台的兼容性,请看一下Delphi的帮助。
procedure TForm1.Button1Click(Sender: TObject);
var
e1, e2: extended;
e3, e4:do
uble;
begin
e1 := 0.00100000000000000011;
e2 := 0.00100000000000000012;
e3 := 0.00100000000000000011;
e4 := 0.00100000000000000012;
if e1 - e2 = 0 then
Label1.Caption := 'equal'
else
Label1.Caption := 'not equal';
if e3 - e4 = 0 then
Label2.Caption := 'equal'
else
Label2.Caption := 'not equal';
end;
问题是跨平台的兼容性,请看一下Delphi的帮助。
procedure TForm1.Button1Click(Sender: TObject);
var
e1, e2: extended;
e3, e4:do
uble;
begin
e1 := 0.00100000000000000011;
e2 := 0.00100000000000000012;
e3 := 0.00100000000000000011;
e4 := 0.00100000000000000012;
if e1 - e2 = 0 then
Label1.Caption := 'equal'
else
Label1.Caption := 'not equal';
if e3 - e4 = 0 then
Label2.Caption := 'equal'
else
Label2.Caption := 'not equal';
end;