begin
comment library 1;
real array
jj[1 : 8];
procedure p(x);
value
x;
integer
x;
;
procedure deviation;
begin
real
x,
y;
p(jj)
end;
deviation;
end
algol
begin
comment library 1;
integer
i,
j,
case;
procedure checkb(bool, answer);
value
answer;
boolean
bool;
integer
answer;
begin
boolean
b;
procedure fail;
begin
outreal(1, i);
outreal(1, j);
outreal(1, case)
end;
for i := 0,
1 do
for j := 0,
1 do
begin
b := answer div 2 * 2 = answer;
if b then
begin
if bool then
else
fail
end
else if bool then
fail;
answer := answer div 2;
end;
case := case + 1
end checkb;
case := 1;
checkb(j = 0 or i = 0, 8);
checkb(j = 0 and i = 0, 14);
checkb(j = 0 equiv i = 0, 6);
checkb(j = 0 impl i = 0, 4);
checkb(j = 0, 10);
checkb( not (j = 0), 5);
outreal(1, case)
end
algol
begin
comment library 1;
integer
i;
integer array
c[1 : 3];
for i := 1,
2,
3 do
c[i] := i + 1;
for i := 1,
2,
3 do
if c[c[c[c[c[c[i] - 1] - 1] - 1] - 1] - 1] \= i + 1
then
outreal(1, i);
outreal(1, 0)
end
algol
begin
comment library 1;
integer
i,
j,
k;
boolean
p,
t;
procedure fail;
begin
outreal(1, i);
outreal(1, j)
end;
t := true;
for i := - 1,
0,
1 do
for j := - 1,
0,
1 do
begin
k := 3 * (i + 1) + j + 2;
if k div 2 * 2 = k equiv t then
fail;
t := not t;
if (i + j > 1 and j \= 1) or (i + j < - 1
and i \= - 1) then
fail;
if not (k >= 7 and i \= 1 impl k < 0) then
fail;
p := i = j;
if p and i * j < 0 then
fail
end;
outreal(1, 0)
end
algol
begin
comment library 1;
real
x,
y,
z,
u;
integer
i,
case;
procedure compare(u, v);
value
u,
v;
real
u,
v;
begin
case := case + 1;
if u \= v then
begin
outreal(1, u);
outreal(1, v);
outreal(1, case)
end;
end;
case := 0;
x := 1.2;
y := 16.96;
z := - 13.4;
for i := 1 step 1 until 10 do
begin
compare( - x * y, - (x * y));
compare( - x / y, - (x / y));
compare(x + y + z, (x + y) + z);
compare(x * y * z, (x * y) * z);
compare(x / y / z, (x / y) / z);
compare(x * y / z, (x * y) / z);
compare(x^2 / y, (x * x) / y);
compare(x * y^2, x * (y * y));
u := 1.01 * x;
x := 1.01 * y;
y := 1.01 * z;
z := u;
end;
outreal(1, 0)
end
algol
begin
comment library 1;
real
x;
x := + + 1.0;
x := - - x;
outreal(1, + - x)
end
algol
begin
comment library 1;
boolean
b;
b := not true;
b := not ( not b);
b := not not b;
outreal(1, if b then 0 else 1)
end
algol
begin
comment library 1;
real
x;
integer
i;
procedure notfunction(y);
value
y;
real
y;
begin
i := i + 1;
x := y
end;
x := 1.0;
i := 0;
x := 3 * notfunction(4.0);
outreal(1, x + notfunction(x) + i)
end
algol
begin
comment library 1;
real
x,
y;
real procedure p(z);
value
z;
real
z;
begin
x := z + y
end;
real procedure q(z);
value
z;
real
z;
if false then
q := z + x + y;
x := y := 1.0;
outreal(1, p(10.0) + q(100.0))
end
algol
begin
comment library 1;
real
x,
y;
procedure p(a, b, c);
value
a,
b,
c;
real
a,
b,
c;
begin
x := a + b * c;
y := x + a
end;
p(1.0,, 3);
outreal(1, x)
end
kdf9