denbcd
Decimal Encode BCD
Encodes a DFP number into BCD format.
Details
Encodes a decimal floating-point number in FRB into Binary Coded Decimal (BCD) format and places the result in FRT. The sign control field S determines how the sign is encoded. This instruction handles conversion of the coefficient and exponent into BCD representation. FPSCR is updated based on invalid operations.
Pseudocode Operation
dfp_value ← FRB
sign ← extract_sign(dfp_value)
coefficient ← extract_coefficient(dfp_value)
exponent ← extract_exponent(dfp_value)
bcd_result ← encode_to_bcd(sign, coefficient, exponent, S)
FRT ← bcd_result
FPSCR ← updated based on encoding result
Programming Note
The denbcd instruction is used to convert a Binary-Coded Decimal (BCD) value into Data-Packed Decimal (DPD) format. Ensure that the input BCD value in FRB is correctly formatted and aligned as required by the instruction. This operation does not raise exceptions for valid inputs but may require careful handling of special cases like overflow or invalid data.
Example
Encoding
Operands
-
FRT
Target -
FRB
Source -
S
Sign Control