dqua

Decimal Quantize

dqua FRT,FRA,FRB,RMC

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

Encoding

Binary Layout
0
FRT
FRA
FRB
RMC
Rc
3
21
23
 
Format X-form
Opcode 0xEC000006

Operands

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

Example

dqua f1, f2, f3

// Align decimal points.

Registers Altered

FPSCR, FPRF, FR, FI, FX, XX, VXSNAN, VXCVI, CR1

Related

More in Decimal Floating-Point

Reference

Description

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.

Operation

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

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

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.