drrndq

Decimal Reround Quad-Precision

drrndq vD, vA, vB

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

drrndq vd, va, vb

Encoding

Binary Layout
63
0
vD
6
vA
11
vB
16
98
21
/
31
 
Format X-form
Opcode 0xFC000046
Extension Decimal Floating-Point
Registers Altered FPSCR

Operands

  • vD
    Target
  • vA
    Source
  • vB
    Control