ctfix
Convert To Fixed
Converts a decimal floating-point value to a fixed-point integer.
Details
Converts a Decimal Floating-Point value in FRA to a fixed-point integer representation and stores the result in FRT. This instruction requires the Decimal Floating-Point category and may set exception flags in FPSCR if conversion fails or overflow/underflow occurs.
Pseudocode Operation
FRT ← convert_dfp_to_fixed(FRA)
# FPSCR exception flags updated as needed
Programming Note
The ctfix instruction is used to convert floating-point numbers to fixed-point integers. Ensure the source operand is properly aligned and within valid range to avoid exceptions. Be cautious of rounding modes as they can affect the result significantly. This instruction operates at user privilege level but may trigger exceptions like inexact conversion or invalid operations, which need to be handled appropriately.
Example
Encoding
Operands
-
FRT
Target Floating-Point Register -
FRA
Source Floating-Point Register