dquai

DFP Quantize Immediate

dquai TE,FRT,FRB,RMC
dquai. TE,FRT,FRB,RMC

Adjusts the value to a form having the specified exponent in the range -16 to 15.

Details

The DFP operand in FRB is converted and rounded to the form with the exponent specified by TE based on the rounding mode specified in the RMC field. The result of that form is placed in FRT. The sign of the result is the same as the sign of the operand in FRB.

Pseudocode Operation

if 'dquai' then
    FRT <- (FRB) adjusted to exponent TE with rounding based on RMC
    if result would cause overflow from the most significant digit, then
        FRT <- default QNaN
    else
        FRT <- adjusted value (left shifted with matching exponent)
if 'dquai.' then
    FRT <- (FRB) adjusted to exponent TE with rounding based on RMC
    if result would cause overflow from the most significant digit, then
        FRT <- default QNaN
    else
        FRT <- adjusted value (left shifted with matching exponent)
    CR1 <- updated

Programming Note

DFP Quantize Immediate can be used to adjust values to a form having the specified exponent in the range -16 to 15. If the adjustment requires the significand to be shifted left, then: if the result would cause overflow from the most significant digit, the result is a default QNaN; otherwise the result is the adjusted value (left shifted with matching exponent). If the adjustment requires the significand to be shifted right, the result is rounded based on the value of the RMC field.

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

Example

dquai te, f1, f3, 0

Encoding

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

Operands

  • TE
    Target Exponent
  • FRT
    Target Floating-Point Register
  • FRB
    Source Floating-Point Register
  • RMC
    Rounding Mode Control