Couperin a écrit :
Here is a program to illustrate this problem : (The bug appears if X > 63)
Program Bug01;
Const XValueMax = 125; Type T_XValue = Packed 0..XValueMax; Var X : T_XValue; Begin Writeln; Write('X ? '); Readln(X);
Writeln('X = ',X); Writeln('X > 63 : ',X > 63); {BUG} Writeln('X < 63 : ',X < 63); {BUG} Writeln('X = 63 : ',X = 63); Writeln('X >= 63 : ',X >= 63); {BUG} Writeln('X <= 63 : ',X <= 63); {BUG} Writeln('X <> 63 : ',X <> 63); {BUG}
Writeln('Real(X) > 63 : ',Real(X) > 63); Writeln('Real(X) < 63 : ',Real(X) < 63); Writeln('Real(X) = 63 : ',Real(X) = 63); Writeln('Real(X) >= 63 : ',Real(X) >= 63); Writeln('Real(X) <= 63 : ',Real(X) <= 63); Writeln('Real(X) <> 63 : ',Real(X) <> 63);
Writeln('X > Real(63) : ',X > Real(63)); Writeln('X < Real(63) : ',X < Real(63)); Writeln('X = Real(63) : ',X = Real(63)); Writeln('X >= Real(63) : ',X >= Real(63)); Writeln('X <= Real(63) : ',X <= Real(63)); Writeln('X <> Real(63) : ',X <> Real(63));
Writeln('Integer(X) > 63 : ',Integer(X) > 63); {BUG} Writeln('X > Integer(63) : ',X > Integer(63)); {BUG} End.
I suppose that you have ineed found a bug. To understand what is going on I have added a declaration
var Y: byte absolute X;
which enables to examine the binary contents of X. It is the same (at least for x=64) and all tests work as expected if you replace X by Y
???