drrnd

Decimal Floating-Point Reround

drrnd FRT,FRA,FRB,RMC

drrnd. FRT,FRA,FRB,RMC

Rounds a decimal floating-point value to the specified number of significant digits.

Details

Rounds a decimal floating-point value in FRB to the number of significant digits specified in FRA, using the rounding mode in RMC, and stores the result in FRT. This instruction is part of the Decimal Floating-Point category. The Rc bit controls whether the condition register CR1 is updated with FPCC and exception flags.

Pseudocode Operation

k ← DecimalSignificance(FRA)
FPR(FRT) ← RoundDecimal(FRB, k, RMC)
if Rc = 1 then CR1 ← FPCC || FPSCR[OX,UX,ZX,XX]

Programming Note

DFP Reround can be used to adjust a DFP value to have no more than a specified number of significant digits. The result is right-justified and rounded as specified by RMC.

Example

drrnd f1, f2, f3, 0

Encoding

Binary Layout
0
0
FRT
6
FRA
11
FRB
16
RMC
21
Rc
31
 
Format Z23-form
Opcode 0xEC000046
Extension Decimal Floating-Point
Registers Altered FPSCR, (FPRF, FR, FI, FX, XX), VXSNAN, VXCVI, CR0

Operands

  • FRT
    Target Floating-Point Register
  • FRA
    Source Floating-Point Register containing the reference significance
  • FRB
    Source Floating-Point Register containing the value to be rounded
  • RMC
    Rounding Mode Control
  • k
    Number of significant digits