drrndq
Decimal Reround Quad-Precision
Rerounds a 128-bit DFP number to fewer digits.
Details
Rerounds a 128-bit decimal floating-point number in vA to a precision specified by control information in vB, storing the result in vD. This operation reduces the number of significant digits while adjusting the exponent accordingly. Rounding uses the mode specified in FPSCR[RN]. The instruction is part of the Decimal Floating-Point extension.
Pseudocode Operation
vD ← ReroundDFP128(vA, vB, FPSCR[RN])
Programming Note
The drrndq instruction is used for precise decimal arithmetic operations, particularly useful in financial applications where exact decimal representation is crucial. Ensure that the source operands (FRA and FRB) are correctly aligned and formatted as quad-precision decimals to avoid precision loss. The rounding mode control (RMC) should be set according to the desired rounding behavior, such as round-to-nearest or truncate. This instruction operates at a privilege level that allows access to floating-point operations, and it may raise exceptions if operands are out of range or if there are invalid operations.
Example
Encoding
Operands
-
vD
Target -
vA
Source -
vB
Control