         Edinburgh IMP77 Compiler - Version 8.4

    1  %begin
    2  
    3  %routine print 68k(%real x, %integer n,m)
    4  %constreal pmax = 2147483647.0
    5  %real y,z
    6  %integer i=0,l,count=0,sign
    7    sign = ' '
    8    sign = '-' %if x < 0
    9    y = |x|+0.5/10.0\{^}m;  !modulus, rounded
   10    %if y > pmax %start
   11      count = count+1 %and y = y/10.0 %until y < 10.0
   12    %finish
   13    z = 1.0
   14    %cycle
   15      i = i+1;  z = z*10.0
   16    %repeat %until z > y
   17    spaces(n-i)
   18    printsymbol(sign) %unless sign = ' ' %and n <= 0
   19    %cycle
   20      z = z/10.0
   21      l = int pt(y/z)
   22      y = y-l*z
   23      printsymbol(l+'0')
   24      i = i-1
   25      %exit %if i+m <= 0
   26      print symbol('.') %if i = 0
   27    %repeat
   28    printsymbol('@') {%and write 68k(count,0)} %if count # 0
   29  %end;  !print
   30  
   31  %routine printfl 68k(%real x, %integer n)
   32  %real y,round
   33  %integer count=-99,sign=0
   34    %if x # 0 %start
   35      x = -x %and sign = 1 %if x < 0
   36     !Adjust X so that 1.0 <= rounded(X) < 10.0
   37      count = 0;  round = 0.5\{^}n
   38      y = 1.0-round
   39      %if x < y %start;  !ie rounded(X) < 1.0
   40        count = count-1 %and x = x*10.0 %until x >= y
   41      %finish %else %start
   42        y = 10.0-round
   43        %while x >= y %cycle;  !ie rounded(X) > 10.0
   44          count = count+1;  x = x/10.0
   45        %repeat
   46      %finish
   47      x = -x %if sign # 0
   48    %finish
   49    print 68k(x,1,n)
   50    printsymbol('@')
   51  !  write 68k(count,0)
   52  %end;  !printfl
   53  
   54  %endofprogram
?PRINTFL68K unused

   52 Statements compiled
