[fpc-pascal] Floating point question

Jean SUZINEAU jean.suzineau at wanadoo.fr
Tue Feb 6 22:26:37 CET 2024


I've just made a small test with the old Borland Delphi 7.0 build 4453 
from 2002 :

...

type
   TForm1 = class(TForm)
     m: TMemo;
     procedure FormCreate(Sender: TObject);
   end;

...

procedure TForm1.FormCreate(Sender: TObject);
var
    GG: Extended;
    S: String;
begin
      GG := 8427+33/1440.0;
      Str( GG: 20 : 20, S);
      m.Lines.Add( 'GG = '+S);
end;

I get :

GG = 8427.02291666666667000000

But I'm cautious, it's a delphi 7 running on a broken installation of 
Wine on Ubuntu 22.04,
I had to modify an existing delphi 7 project for this test, I couldn't 
save a new project because of problems with wine.

I have an old astronomical made with delphi 7 that I've written around 
2000, and I ported a part of it to Freepascal, I'm nearly sure there are 
unnoticed errors in this freepascal port due to to this behaviour ...
(Not really a problem because the program isn't sold any more, but I'll 
have a look next time I compile it)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20240206/660bd9f6/attachment.htm>


More information about the fpc-pascal mailing list