dqua

Decimal Quantize

dqua FRT,FRA,FRB,RMC
dqua. FRT,FRA,FRB,RMC

Adjusts the exponent of a DFP number to match a reference. Critical for aligning decimal points before addition.

Details

Adjusts the exponent of a 64-bit DFP number to match a reference exponent, rounding the significand as needed according to the RMC control bits. This operation is essential for aligning decimal points before addition in financial calculations. The instruction can optionally update CR0 via the dot form; FPSCR is always updated with exception flags.

Pseudocode Operation

FPR[FRT] ← DFP_quantize(FPR[FRA], FPR[FRB], RMC)
FPSCR ← updated with exception flags
if Rc = 1 then CR0 ← condition_code(FPR[FRT])

Programming Note

DFP Quantize can be used to adjust one DFP value to a form having the same exponent as another DFP value. If the adjustment requires the significand to be shifted left and would cause overflow from the most significant digit, the result is a default QNaN.

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

Example

dqua f1, f2, f3

// Align decimal points.

Encoding

Binary Layout
0
0
FRT
6
FRA
11
FRB
16
RMC
21
Rc
23
3
28
21
31
23
 
Format X-form
Opcode 0xEC000006
Extension Decimal Floating-Point
Registers Altered FPSCR, FPRF, FR, FI, FX, XX, VXSNAN, VXCVI, CR1

Operands

  • FRT
    Target
  • FRA
    Source Value
  • FRB
    Reference Exponent
  • RMC
    Rounding Mode Control