#include <perms.h>

                                                                //      1  %systemstring(127)%fnspec rtos(%real r,%integer n,m)
#line 1 "regression-bugs-tmp/rtof.imp"
extern _imp_string /*%string(127)*/ rtos( float R, int N, int M );
                                                                //      2  %systemstring(127)%fn rtof(%real x, %integer n)
#line 2 "regression-bugs-tmp/rtof.imp"
extern _imp_string /*%string(127)*/ rtof( float X, int N )
#line 2 "regression-bugs-tmp/rtof.imp"
{
                                                                //      3    %real y,round
#line 3 "regression-bugs-tmp/rtof.imp"
float Y;
#line 3 "regression-bugs-tmp/rtof.imp"
float ROUND;
                                                                //      4    %integer count=-99,sign=0
#line 4 "regression-bugs-tmp/rtof.imp"
int COUNT;
#line 4 "regression-bugs-tmp/rtof.imp"
COUNT = (-99);
#line 4 "regression-bugs-tmp/rtof.imp"
int SIGN;
#line 4 "regression-bugs-tmp/rtof.imp"
SIGN = 0;
                                                                //      5    %string(127) result=""
#line 5 "regression-bugs-tmp/rtof.imp"
_imp_string /*%string(127)*/ RESULT;
#line 5 "regression-bugs-tmp/rtof.imp"
RESULT = _imp_str_literal("");
                                                                //      6    !
                                                                //      7    %if x # 0 %start
#line 7 "regression-bugs-tmp/rtof.imp"
if (((X) == (0))) goto L_0002;
                                                                //      8      x = -x %and sign = 1 %if x < 0
#line 8 "regression-bugs-tmp/rtof.imp"
if (((X) >= (0))) goto L_0003;
#line 8 "regression-bugs-tmp/rtof.imp"
X = (-(X));
#line 8 "regression-bugs-tmp/rtof.imp"
SIGN = 1;
#line 8 "regression-bugs-tmp/rtof.imp"
L_0003:;
                                                                //      9     !Adjust X so that 1.0 <= rounded(X) < 10.0
                                                                //     10      count = 0;  round = 0.5\{^}n
#line 10 "regression-bugs-tmp/rtof.imp"
COUNT = 0;
#line 10 "regression-bugs-tmp/rtof.imp"
ROUND = _imp_REXP(0.5, N);
                                                                //     11      y = 1.0-round
#line 11 "regression-bugs-tmp/rtof.imp"
Y = ((1.0) - ((double)(ROUND)));
                                                                //     12      %if x < y %start;  !ie rounded(X) < 1.0
#line 12 "regression-bugs-tmp/rtof.imp"
if (((X) >= (Y))) goto L_0004;
                                                                //     13        count = count-1 %and x = x*10.0 %until x >= y
#line 13 "regression-bugs-tmp/rtof.imp"
L_0005:;
#line 13 "regression-bugs-tmp/rtof.imp"
COUNT = (((int)(COUNT)) - (1));
#line 13 "regression-bugs-tmp/rtof.imp"
X = (((double)(X)) * (10.0));
#line 13 "regression-bugs-tmp/rtof.imp"
if (((X) >= (Y))) goto L_0006;
#line 13 "regression-bugs-tmp/rtof.imp"
goto L_0005;
#line 13 "regression-bugs-tmp/rtof.imp"
L_0006:;
                                                                //     14      %finish %else %start
#line 14 "regression-bugs-tmp/rtof.imp"
goto L_0008;
#line 14 "regression-bugs-tmp/rtof.imp"
L_0004:;
                                                                //     15        y = 10.0-round
#line 15 "regression-bugs-tmp/rtof.imp"
Y = ((10.0) - ((double)(ROUND)));
                                                                //     16        %while x >= y %cycle;  !ie rounded(X) > 10.0
#line 16 "regression-bugs-tmp/rtof.imp"
L_0009:;
#line 16 "regression-bugs-tmp/rtof.imp"
if (((X) < (Y))) goto L_000a;
                                                                //     17          count = count+1;  x = x/10.0
#line 17 "regression-bugs-tmp/rtof.imp"
COUNT = (((int)(COUNT)) + (1));
#line 17 "regression-bugs-tmp/rtof.imp"
X = (double)((double)((float)(X)) / (double)((double)(10.0)));
                                                                //     18        %repeat
#line 18 "regression-bugs-tmp/rtof.imp"
goto L_0009;
#line 18 "regression-bugs-tmp/rtof.imp"
L_000a:;
                                                                //     19      %finish
#line 19 "regression-bugs-tmp/rtof.imp"
L_0008:;
                                                                //     20      x = -x %if sign # 0
#line 20 "regression-bugs-tmp/rtof.imp"
if (((SIGN) == (0))) goto L_000c;
#line 20 "regression-bugs-tmp/rtof.imp"
X = (-(X));
#line 20 "regression-bugs-tmp/rtof.imp"
L_000c:;
                                                                //     21    %finish
#line 21 "regression-bugs-tmp/rtof.imp"
L_0002:;
                                                                //     22    result = rtos(x,1,n)
#line 22 "regression-bugs-tmp/rtof.imp"
RESULT = rtos(X, 1, N);
                                                                //     23    result = result."@".itos(count,0)
#line 23 "regression-bugs-tmp/rtof.imp"
RESULT = _imp_join((_imp_string)_imp_join((_imp_string)RESULT,(_imp_string)_imp_str_literal("@")),(_imp_string)_imp_ITOS(COUNT, 0));
                                                                //     24    %result = result
#line 24 "regression-bugs-tmp/rtof.imp"
/* Remove %on %event handler here if present for this block */
return RESULT;
                                                                //     25  %end;  !flrtos
#line 25 "regression-bugs-tmp/rtof.imp"
} // End of block rtof at level 1
                                                                //     26  
                                                                //     27  %endoffile
#line 27 "regression-bugs-tmp/rtof.imp"
// End of file
