[net.unix-wizards] PASCAL BUG?

coltoff (10/20/82)

Here is one that is driving us crazy tracking down the problem.
Can someone help us out.

The following PASCAL program

program bug (input,output);
const
    x1 = 200;
    x2 = 200.0;
var
    x: real;
begin
    x := x1;
    write(x:6:3);
    x := x2;
    write(x:6:3);
end.

produces this output

 -56.000 200.000

This is clearly not what I would expect and while it isn't difficult
to work around in the programs I deal with it is still a pain in the
gazabahs. As they say, `Thanks in advance'

Joel Coltoff
lime!burdvax!coltoff

thomas (10/22/82)

Now, I can't say for sure, but it looks as if somebody is storing that
integer constant (200) in a byte (it fits, after all, 200 < 256), but
then treating said byte as a signed quantity (i.e., -56).
=Spencer