         Edinburgh IMP77 Compiler - Version 8.4

    1  %systemstring(127)%fnspec rtos(%real r,%integer n,m)
    2  %systemstring(127)%fn rtof(%real x, %integer n)
    3    %real y,round
    4    %integer count=-99,sign=0
    5    %string(127) result=""
    6    !
    7    %if x # 0 %start
    8      x = -x %and sign = 1 %if x < 0
    9     !Adjust X so that 1.0 <= rounded(X) < 10.0
   10      count = 0;  round = 0.5\{^}n
   11      y = 1.0-round
   12      %if x < y %start;  !ie rounded(X) < 1.0
   13        count = count-1 %and x = x*10.0 %until x >= y
   14      %finish %else %start
   15        y = 10.0-round
   16        %while x >= y %cycle;  !ie rounded(X) > 10.0
   17          count = count+1;  x = x/10.0
   18        %repeat
   19      %finish
   20      x = -x %if sign # 0
   21    %finish
   22    result = rtos(x,1,n)
   23    result = result."@".itos(count,0)
   24    %result = result
   25  %end;  !flrtos
   26  
   27  %endoffile

   26 Statements compiled
