#include <perms.h>

                                                                //      1  %EXTERNALSTRING(255)%SPEC ERRMSG
#line 1 "regression-bugs-tmp/printfl2.imp"
extern _imp_string /*%string(255)*/ ERRMSG;
                                                                //      2  !%EXTERNALREALFNSPEC FRACPT(%LONGREAL R)
                                                                //      3  
                                                                //      4  
                                                                //      5  %ROUTINE FRACTION(%REAL R, %INTEGER PLACES)
#line 5 "regression-bugs-tmp/printfl2.imp"
void FRACTION( float R, int PLACES )
#line 5 "regression-bugs-tmp/printfl2.imp"
{
                                                                //      6    %RETURN %IF PLACES<=0
#line 6 "regression-bugs-tmp/printfl2.imp"
if (((PLACES) > (0))) goto L_0002;
#line 6 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
#line 6 "regression-bugs-tmp/printfl2.imp"
L_0002:;
                                                                //      7    PRINTSYMBOL('.')
#line 7 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL(46);
                                                                //      8    %WHILE PLACES>0 %CYCLE
#line 8 "regression-bugs-tmp/printfl2.imp"
L_0003:;
#line 8 "regression-bugs-tmp/printfl2.imp"
if (((PLACES) <= (0))) goto L_0004;
                                                                //      9      R = FRACPT(R)*10.0
#line 9 "regression-bugs-tmp/printfl2.imp"
R = (((double)(_imp_FRACPT(R))) * (10.0));
                                                                //     10      PLACES=PLACES-1
#line 10 "regression-bugs-tmp/printfl2.imp"
PLACES = (((int)(PLACES)) - (1));
                                                                //     11      PRINTSYMBOL(INTPT(R)+'0')
#line 11 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL((((int)(_imp_INTPT(R))) + (48)));
                                                                //     12    %REPEAT
#line 12 "regression-bugs-tmp/printfl2.imp"
goto L_0003;
#line 12 "regression-bugs-tmp/printfl2.imp"
L_0004:;
                                                                //     13  %END
#line 13 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block FRACTION at level 1
                                                                //     14  
                                                                //     15  
                                                                //     16  !  %routine PRINT(%long %real X, %integer I, J)
                                                                //     17  !
                                                                //     18  !     This routine transmits to the currently selected output stream the
                                                                //     19  !     value of the real expression specified by the first parameter.  The
                                                                //     20  !     second and third parameters should be integer expressions
                                                                //     21  !     specifying the number of places to be allowed before and after the
                                                                //     22  !     decimal point.  If the integer part needs more positions than are
                                                                //     23  !     specified by the parameter, then more positions will be taken.  One
                                                                //     24  !     position is allowed for a sign which is printed only in the
                                                                //     25  !     negative case.  If necessary, the fractional part will be rounded.
                                                                //     26  !
                                                                //     27  !     Examples:
                                                                //     28  !                   PRINT(A, 2, 3)
                                                                //     29  !                   PRINT(COS(A-B), 1, 10)
                                                                //     30  !
                                                                //     31  !     {IMP77: The second parameter is interpreted in the same way as the
                                                                //     32  !             second parameter of WRITE (described above).}
                                                                //     33  
                                                                //     34  
                                                                //     35  !  %routine PRINT FL(%longreal X, %integer I)
                                                                //     36  !
                                                                //     37  !     This routine transmits to the currently selected output stream the
                                                                //     38  !     value of the real expression specified by the first parameter.  The
                                                                //     39  !     second parameter specifies the number of places to be allowed after
                                                                //     40  !     the decimal point.  The printed number takes up the specified
                                                                //     41  !     number of places, plus 7 additional places.
                                                                //     42  !
                                                                //     43  !     Example:
                                                                //     44  !                   PRINT FL(X,4)
                                                                //     45  !
                                                                //     46  !     If X has the value 17.63584, this would be printed as  1.7636@ 1.
                                                                //     47  !     The number is standardised in the range 1 <= X < 10.  One position
                                                                //     48  !     each is allowed for signs for mantissa and exponent; in each case
                                                                //     49  !     the sign is only printed when negative.
                                                                //     50                      
                                                                //     51  
                                                                //     52  %EXTERNALROUTINE PRINTFL(%REAL R, %INTEGER P)
#line 52 "regression-bugs-tmp/printfl2.imp"
void PRINTFL( float R, int P )
#line 52 "regression-bugs-tmp/printfl2.imp"
{
                                                                //     53    %INTEGER EXP,SIGN
#line 53 "regression-bugs-tmp/printfl2.imp"
int EXP;
#line 53 "regression-bugs-tmp/printfl2.imp"
int SIGN;
                                                                //     54    SIGN=' '
#line 54 "regression-bugs-tmp/printfl2.imp"
SIGN = 32;
                                                                //     55    SIGN='-' %AND R=-R %IF R<0
#line 55 "regression-bugs-tmp/printfl2.imp"
if (((R) >= (0))) goto L_0006;
#line 55 "regression-bugs-tmp/printfl2.imp"
SIGN = 45;
#line 55 "regression-bugs-tmp/printfl2.imp"
R = (-(R));
#line 55 "regression-bugs-tmp/printfl2.imp"
L_0006:;
                                                                //     56    PRINTSYMBOL(SIGN)
#line 56 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL(SIGN);
                                                                //     57    %IF R=0 %START
#line 57 "regression-bugs-tmp/printfl2.imp"
if (((R) != (0))) goto L_0007;
                                                                //     58      EXP=-99
#line 58 "regression-bugs-tmp/printfl2.imp"
EXP = (-99);
                                                                //     59    %ELSE
#line 59 "regression-bugs-tmp/printfl2.imp"
goto L_0008;
#line 59 "regression-bugs-tmp/printfl2.imp"
L_0007:;
                                                                //     60      %IF P<=0 %START
#line 60 "regression-bugs-tmp/printfl2.imp"
if (((P) > (0))) goto L_0009;
                                                                //     61        R=R+0.5
#line 61 "regression-bugs-tmp/printfl2.imp"
R = (((double)(R)) + (0.5));
                                                                //     62      %ELSE
#line 62 "regression-bugs-tmp/printfl2.imp"
goto L_000a;
#line 62 "regression-bugs-tmp/printfl2.imp"
L_0009:;
/*promote*/                                                                //     63        R=R+0.5*10\(-P)
#line 63 "regression-bugs-tmp/printfl2.imp"
R = ((R) + ((float)(((0.5) * ((double)(_imp_REXP(10, (-(P)))))))));
                                                                //     64      %FINISH
#line 64 "regression-bugs-tmp/printfl2.imp"
L_000a:;
                                                                //     65      EXP=0
#line 65 "regression-bugs-tmp/printfl2.imp"
EXP = 0;
                                                                //     66      EXP=EXP+1 %AND R=R*0.1 %WHILE R >=10.0
#line 66 "regression-bugs-tmp/printfl2.imp"
L_000b:;
#line 66 "regression-bugs-tmp/printfl2.imp"
if (((R) < (10.0))) goto L_000c;
#line 66 "regression-bugs-tmp/printfl2.imp"
EXP = (((int)(EXP)) + (1));
#line 66 "regression-bugs-tmp/printfl2.imp"
R = (((double)(R)) * (0.1));
#line 66 "regression-bugs-tmp/printfl2.imp"
goto L_000b;
#line 66 "regression-bugs-tmp/printfl2.imp"
L_000c:;
                                                                //     67      EXP=EXP-1 %AND R=R*10.0 %WHILE R< 1.0
#line 67 "regression-bugs-tmp/printfl2.imp"
L_000e:;
#line 67 "regression-bugs-tmp/printfl2.imp"
if (((R) >= (1.0))) goto L_000f;
#line 67 "regression-bugs-tmp/printfl2.imp"
EXP = (((int)(EXP)) - (1));
#line 67 "regression-bugs-tmp/printfl2.imp"
R = (((double)(R)) * (10.0));
#line 67 "regression-bugs-tmp/printfl2.imp"
goto L_000e;
#line 67 "regression-bugs-tmp/printfl2.imp"
L_000f:;
                                                                //     68    %FINISH
#line 68 "regression-bugs-tmp/printfl2.imp"
L_0008:;
                                                                //     69    PRINTSYMBOL(INT PT(R)+'0')
#line 69 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL((((int)(_imp_INTPT(R))) + (48)));
                                                                //     70    FRACTION(R,P)
#line 70 "regression-bugs-tmp/printfl2.imp"
FRACTION(R, P);
                                                                //     71    PRINTSYMBOL('@'); WRITE(EXP,1)
#line 71 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL(64);
#line 71 "regression-bugs-tmp/printfl2.imp"
_imp_WRITE(EXP, 1);
                                                                //     72  %END
#line 72 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block PRINTFL at level 1
                                                                //     73  
                                                                //     74  %EXTERNALROUTINE PRINT(%REAL R, %INTEGER B,A)
#line 74 "regression-bugs-tmp/printfl2.imp"
void PRINT( float R, int B, int A )
#line 74 "regression-bugs-tmp/printfl2.imp"
{
                                                                //     75    %REAL RM
#line 75 "regression-bugs-tmp/printfl2.imp"
float RM;
                                                                //     76    %CONSTINTEGER MAX INT= 8_377777777777
                                                                //     77    %INTEGER SIGN
#line 77 "regression-bugs-tmp/printfl2.imp"
int SIGN;
                                                                //     78    %ROUTINE P(%INTEGER N)
#line 78 "regression-bugs-tmp/printfl2.imp"
void P( int N )
#line 78 "regression-bugs-tmp/printfl2.imp"
{
                                                                //     79      B = B-1
#line 79 "regression-bugs-tmp/printfl2.imp"
B = (((int)(B)) - (1));
                                                                //     80      P(N//10) %IF N >= 10
#line 80 "regression-bugs-tmp/printfl2.imp"
if (((N) < (10))) goto L_0011;
#line 80 "regression-bugs-tmp/printfl2.imp"
P(((long)((long)((int)(N)) / (long)((int)(10)))));
#line 80 "regression-bugs-tmp/printfl2.imp"
L_0011:;
                                                                //     81      %IF SIGN # 0 %START
#line 81 "regression-bugs-tmp/printfl2.imp"
if (((SIGN) == (0))) goto L_0012;
                                                                //     82        SPACES(B-1)
#line 82 "regression-bugs-tmp/printfl2.imp"
_imp_SPACES((((int)(B)) - (1)));
                                                                //     83        PRINTSYMBOL(SIGN);  SIGN = 0
#line 83 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL(SIGN);
#line 83 "regression-bugs-tmp/printfl2.imp"
SIGN = 0;
                                                                //     84      %FINISH
#line 84 "regression-bugs-tmp/printfl2.imp"
L_0012:;
                                                                //     85      PRINTSYMBOL(REM(N,10)+'0')
#line 85 "regression-bugs-tmp/printfl2.imp"
_imp_PRINTSYMBOL((((int)(_imp_REM(N, 10))) + (48)));
                                                                //     86    %END
#line 86 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block P at level 2
                                                                //     87    RM=|R|
#line 87 "regression-bugs-tmp/printfl2.imp"
RM = _imp_MOD(R);
                                                                //     88    PRINTFL(R, B+A) %AND %RETURN %IF RM> MAX INT
#line 88 "regression-bugs-tmp/printfl2.imp"
if (((RM) <= ((-1)))) goto L_0013;
#line 88 "regression-bugs-tmp/printfl2.imp"
PRINTFL(R, (((int)(B)) + (A)));
#line 88 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
#line 88 "regression-bugs-tmp/printfl2.imp"
L_0013:;
                                                                //     89    %IF A<=0 %START
#line 89 "regression-bugs-tmp/printfl2.imp"
if (((A) > (0))) goto L_0014;
                                                                //     90      RM=RM+0.5
#line 90 "regression-bugs-tmp/printfl2.imp"
RM = (((double)(RM)) + (0.5));
                                                                //     91    %ELSE
#line 91 "regression-bugs-tmp/printfl2.imp"
goto L_0015;
#line 91 "regression-bugs-tmp/printfl2.imp"
L_0014:;
/*promote*/                                                                //     92      RM=RM+0.5*10\(-A)
#line 92 "regression-bugs-tmp/printfl2.imp"
RM = ((RM) + ((float)(((0.5) * ((double)(_imp_REXP(10, (-(A)))))))));
                                                                //     93    %FINISH
#line 93 "regression-bugs-tmp/printfl2.imp"
L_0015:;
                                                                //     94    %IF B<=0 %THEN SIGN=0 %ELSE SIGN=' '
#line 94 "regression-bugs-tmp/printfl2.imp"
if (((B) > (0))) goto L_0016;
#line 94 "regression-bugs-tmp/printfl2.imp"
SIGN = 0;
#line 94 "regression-bugs-tmp/printfl2.imp"
goto L_0017;
#line 94 "regression-bugs-tmp/printfl2.imp"
L_0016:;
#line 94 "regression-bugs-tmp/printfl2.imp"
SIGN = 32;
#line 94 "regression-bugs-tmp/printfl2.imp"
L_0017:;
                                                                //     95    %IF R<0 %THEN SIGN='-'
#line 95 "regression-bugs-tmp/printfl2.imp"
if (((R) >= (0))) goto L_0018;
#line 95 "regression-bugs-tmp/printfl2.imp"
SIGN = 45;
#line 95 "regression-bugs-tmp/printfl2.imp"
L_0018:;
                                                                //     96    P(INT PT(RM));  !THUS ALLOWING FOR -0.1 ETC.
#line 96 "regression-bugs-tmp/printfl2.imp"
P(_imp_INTPT(RM));
                                                                //     97    FRACTION(RM,A)
#line 97 "regression-bugs-tmp/printfl2.imp"
FRACTION(RM, A);
                                                                //     98  %END
#line 98 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return;
} // End of block PRINT at level 1
                                                                //     99  
                                                                //    100  %begin
#line 100 "regression-bugs-tmp/printfl2.imp"
int main(int argc, char **argv) {
  _imp_initialise(argc, argv);
                                                                //    101  %end
#line 101 "regression-bugs-tmp/printfl2.imp"
/* Remove %on %event handler here if present for this block */
return 0;
} // End of block _imp_main at level 1
                                                                //    102  
                                                                //    103  %ENDOFFILE
#line 103 "regression-bugs-tmp/printfl2.imp"
// End of file
