On Sat, 24 Mar 2001, Russ Whitaker wrote:
On Sat, 24 Mar 2001, f.couperin wrote:
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.
[..]
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.
The problem is "A <> B": adding two lines to program writeln('A= ', A); writeln('B= ', B); and I got:
A= 1.030000000000000e+02 B= 1.030000000000000e+02 Failed
Hopes this helps Russ
Why should this help? If A=B the answer should be 'OK'. But there may be the long time known problem with comparing real numbers nearly zero difference, equality comparison of real's is never reliable.
Ernst-Ludwig