ctfix
Convert To Fixed
Converts a decimal floating-point value to a fixed-point integer.
Details
The ctfix instruction converts the source operand b in FRA[p] to a fixed-point integer and places the result in FRT[p]. The conversion is based on the specified rounding mode.
Pseudocode Operation
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