Datasheet
Floating-point Support
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 5-13
Note
It is not guaranteed that the values of these macros will remain the same in future
versions of ARM products. To ensure that your code continues to work if the value
changes in future releases, use the macro rather than its value.
For example, to set the rounding mode to round down, you would do:
_controlfp(_RC_DOWN, _MCW_RC);
To trap the Invalid Operation exception and untrap all other exceptions:
_controlfp(_EM_INVALID, _MCW_EM);
To untrap the Inexact Result exception:
_controlfp(0, _EM_INEXACT);
The _clearfp function
The function
_clearfp
clears all five exception sticky flags, and returns their previous
value. The macros given in Table 5-7 on page 5-12, for example
_EM_INVALID
,
_EM_ZERODIVIDE
, can be used to test bits of the returned result.
_clearfp
has the following prototype:
unsigned _clearfp(void);
_EM_UNDERFLOW
Bit describing the Underflow exception
_EM_INEXACT
Bit describing the Inexact Result exception
_MCW_RC
Mask for the rounding mode field
_RC_CHOP
Rounding mode value describing Round Toward Zero
_RC_UP
Rounding mode value describing Round Up
_RC_DOWN
Rounding mode value describing Round Down
_RC_NEAR
Rounding mode value describing Round To Nearest
Table 5-7 _controlfp argument macros (continued)
Macro Description