dsub
Decimal Subtract
(Rc=0)
Subtracts the contents of two DFP registers and places the result in another DFP register.
Details
The DFP operand in FRB[p] is subtracted from the DFP operand in FRA[p]. The result is rounded to the target-format precision under control of DRN (bits 29:31 of the FPSCR). An appropriate form of the rounded result is selected based on the ideal exponent and is placed in FRT[p]. The ideal exponent is the smaller exponent of the two source operands.
Pseudocode Operation
if 'dsub' then
FRT[p] <- (FRA[p]) - (FRB[p])
Programming Note
The dsub instruction performs a decimal subtraction between two DFP operands. Ensure that both operands are properly aligned and formatted according to the target precision specified in the FPSCR register. Be aware of potential rounding errors based on the current rounding mode set in DRN, and check for any exceptions or flags (like VXSNAN) that may indicate invalid operations or special results.
Example
Encoding
Operands
-
FRT
Target -
FRA
Src A -
FRB
Src B