dquai

DFP Quantize Immediate

dquai TE,FRT,FRB,RMC

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

Encoding

Binary Layout
0
0:5
FRT
6:10
TE
11:15
FRB
16:20
RMC
21:30
Rc
31
 
Format Z23-form
Opcode 0xEC000086

Operands

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

Example

dquai te, f1, f3, 0

Registers Altered

FPSCR(FPRF, FR, FI, FX, XX, VXSNAN, VXCVI), CR(CR1), CR0

Related

More in Decimal Floating-Point

Reference

Description

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.

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

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

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.