DEF VAR MyDecimal AS DEC INIT 0.142857142. /* Solve for this Decimal Value */ DEF VAR Denominator AS INT INIT 64. /* Lowest Fractional Unit of Measure */ DEF VAR Numerator AS INT. /* Used for calculation of Numerator */ /* Initialize the Numerator */ Numerator = INT(MyDecimal * Denominator). /* Calculate the fractional value */ IF Numerator > 1 THEN RUN Calc. /* Check to see if the Decimal value is larger than the fractional value */ IF Numerator / Denominator < MyDecimal THEN DO: Denominator = 64. /* Re-Set the Denominator */ /* Add 1/64th to the Decimal value */ Numerator = INT((MyDecimal + 0.015625) * Denominator). /* Re-Calculate */ RUN Calc. END. /* Display the Fractional value */ DISPLAY Numerator "/" Denominator. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ PROCEDURE Calc: /* Finds lowest fractional unit */ DO WHILE INT(Numerator / 2) * 2 = Numerator: ASSIGN Numerator = Numerator / 2 Denominator = Denominator / 2. END. END PROCEDURE. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */