dadd
Decimal Add
Rc=0
Adds two 64-bit Decimal Floating Point (DFP) numbers. Used in financial calculations to avoid rounding errors.
Details
The dadd instruction adds the contents of FRA and FRB, rounding the result to the target-format precision under control of DRN (bits 29:31 of the FPSCR). The ideal exponent is the smaller exponent of the two source operands. The result is placed in FRT.
Pseudocode Operation
if 'dadd' then
FRT <- (FRA) + (FRB)
round result to target-format precision under control of DRN
set ideal exponent to the smaller exponent of the two source operands
Programming Note
The dadd instruction is used for adding two decimal floating-point numbers. Ensure that the source registers FRA and FRB are correctly aligned and contain valid decimal floating-point values. The result will be rounded according to the rounding mode specified in the FPSCR register's DRN field. Be aware of potential exceptions such as overflow or underflow, which may require handling in your code.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
Example
Encoding
Operands
-
FRT
Target FPR -
FRA
Source A -
FRB
Source B