Hi
In the first email the problem centers around "packed" and I don't know what's it doing.
In the 2nd email, 4 followed by 9 zeros as an integer is a negative number, -294967296
Without typecasting the comparisons are expecting integers So if you change X in the comparisons to longint(X) you get the right results
Perhaps this narrows the problem a little
Russ