home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG066.ARC
/
POWTWO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
512b
|
20 lines
(* decimal representaton of negative powers of 2 *)
const n=10;
type digit = 0..9;
digtyp = array[1..n] of digit;
var i,k,r: integer;
d : digtyp;
begin for k:=1 to n do
begin put#0('.'); r:=0;
for i:=1 to k-1 do
begin r:=10*r+d[i]; d[i]:=r/2;
r:=r-2*d[i]; put#0(d[i]+'0')
end;
d[k]:=5; put#0('5',13,10)
end
end.