Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 3 - Numerics in PowerPC Assembly Language
Chapter 12 - Assembly-Language Environmental Controls


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
ModeBit 30Bit 31
To nearest (default)00
Toward zero01
Upward10
Downward11

Bits 30 and 31 are in FPSCR field 7.

To set the rounding direction, use the mtfsfi instruction. It has the form

mtfsfi    DST, n 
where 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

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996