Important: The information in this document is obsolete and should not be used for new development.
Setting the Rounding Direction
Bits 30 and 31 of the FPSCR specify the current rounding direction, as shown in
Table 12-4. The section "Rounding Direction Modes" in Chapter 4, "Environmental Controls," describes what the different rounding directions do.
Rounding direction bits in the FPSCR Mode Bit 30 Bit 31 To nearest (default) 0 0 Toward zero 0 1 Upward 1 0 Downward 1 1 Bits 30 and 31 are in FPSCR field 7.
To set the rounding direction, use the
mtfsfi
instruction. It has the form
mtfsfi DST, nwhere DST is a 4-bit FPSCR field and n is an integer value to be copied into DST. Here are some examples.
mtfsfi 7,0 # set rounding direction to to-nearest mtfsfi 7,1 # set rounding direction to toward-zero mtfsfi 7,2 # set rounding direction to upward mtfsfi 7,3 # set rounding direction to downward