Copyright (C) 2000-2012 |
GNU Info (nasm.info)Section B.4.95B.4.95. `FPREM', `FPREM1': Floating-Point Partial Remainder ----------------------------------------------------------- FPREM ; D9 F8 [8086,FPU] FPREM1 ; D9 F5 [386,FPU] These instructions both produce the remainder obtained by dividing `ST0' by `ST1'. This is calculated, notionally, by dividing `ST0' by `ST1', rounding the result to an integer, multiplying by `ST1' again, and computing the value which would need to be added back on to the result to get back to the original value in `ST0'. The two instructions differ in the way the notional round-to-integer operation is performed. `FPREM' does it by rounding towards zero, so that the remainder it returns always has the same sign as the original value in `ST0'; `FPREM1' does it by rounding to the nearest integer, so that the remainder always has at most half the magnitude of `ST1'. Both instructions calculate _partial_ remainders, meaning that they may not manage to provide the final result, but might leave intermediate results in `ST0' instead. If this happens, they will set the C2 flag in the FPU status word; therefore, to calculate a remainder, you should repeatedly execute `FPREM' or `FPREM1' until C2 becomes clear. automatically generated by info2www version 1.2.2.9 |