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

The drrnd instruction rounds the contents of register FRB to k significant digits and places the result in register FRT. The rounding mode is determined by the third operand, which specifies the number of significant digits (1 in this case).

Pseudocode Operation

if 'drrnd' then
    FRT <- round(FRB, RMC, reference_significance)
else if 'drrnd.' then
    FRT <- round(FRB, RMC, reference_significance)
    CR1 <- update_condition_register(FRT)

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