Hello,
I don't know if it's really a bug but the result is really surprising. A LongReal variable (of simple integer value) is written into a text file, and when I read this value back : it isn't exactly the same.
In the following program, the problem disappears : - if Var A,B : LongReal; is replaced by Var A,B : Real;
- or if Writeln(TextFile,A); is replaced by Writeln(TextFile,A:0:18);
- or if Readln(TextFile,B); is replaced by Readln(TextFile,B); B := Real(B);
I would like to understand this strange behaviour.
---------------------------------------------------------------------------- -- Program LRealBug; Var A,B : LongReal; TextFile : Text; Begin Assign(TextFile,'tmp'); Rewrite(TextFile); A := 103; Writeln(TextFile,A); Close(TextFile); Reset(TextFile); Readln(TextFile,B); Close(TextFile); Erase (TextFile); If A <> B Then Writeln('Failed') Else Writeln('OK'); End. ---------------------------------------------------------------------------- --
I have : gpc version 20000727, based on 2.95.2 19991024 (release)
-- «Couperin»