Originally Posted by

**ajgargand** Have a look at this program

Code:

var x,y:integer;
var z:real;
begin
x:=22;
y:=7;
z:=x/y;
writeln('z');
end

Output will be 22/7 which is Pi.

22/7=3.14285142851428514285..................

14285 repeat again and again and never halts.

it is a linear algorithm but never halts.

1. is not 22/7, 22/7 is a reasonably good approximation, often attributed to Archimedes.

"The specific statement of Archimedes is Proposition 3 of his treatise *Measurement of a Circle:*

*The ratio of the circumference of any circle to its diameter is less than 3 1/7 but greater than 3 10/71"*

2. In Pascal the default float type is float4 a 32 bit float, and 22/7 will be rounded in whatever manner the machine specifies. There is nothing infinite about you program fragment, and it does halt, but with a 32 bit approximation to 22/7.

RonL