Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FPREM/FPREM1 Instructions
 Detail                                    Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
  Title:    Partial Remainder
 
  Syntax:   FPREM
            FPREM1 (80387/487 only)
 
  Description:
 
     Calculates the remainder of ST divided by ST(1); the result is
     returned in ST. The remainder retains the same sign as the original
     dividend. The calculation uses the following formula:
 
          remainder = ST - ST(1) * quotient
 
     For FPREM, the quotient is the exact value obtained by chopping
     ST / ST(1) toward 0. For FPREM1, the quotient is the integer
     nearest to the exact value of ST / ST(1). When two integers are
     equally close to the given value, the even integer is used. FPREM1
     conforms to the IEEE standard.
 
     These instructions are normally used in a loop that repeats until
     the reduction is complete, as indicated by the condition codes of
     the status word.
 
     The condition codes for FPREM and FPREM1 are as follows:
 
     C3     C2     C1     C0     Meaning
 
     ?      1      ?      ?      Incomplete reduction
     0      0      0      0      Quotient MOD 8 = 0
     0      0      0      1      Quotient MOD 8 = 4
     0      0      1      0      Quotient MOD 8 = 1
     0      0      1      1      Quotient MOD 8 = 5
     1      0      0      0      Quotient MOD 8 = 2
     1      0      0      1      Quotient MOD 8 = 6
     1      0      1      0      Quotient MOD 8 = 3
     1      0      1      1      Quotient MOD 8 = 7
                                    -♦-