Datasheet
Floating-point Support
5-14 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
The _statusfp function
The function
_statusfp
returns the current value of the exception sticky flags. 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.
_statusfp
has the following prototype:
unsigned _statusfp(void);
5.3.4 C9X-compatible functions
In addition to the above functions, ARM also supports a set of functions defined in the
C9X draft standard. These functions are the only interface that allows you to install
custom exception trap handlers with the ability to invent a return value. All the
functions, types, and macros in this section are defined in
fenv.h
.
C9X defines two data types,
fenv_t
and
fexcept_t
. The C9X draft standard does not
define any details about these types, so for portable code you must treat them as opaque.
ARM defines them to be structure types, for details see ARM extensions to the C9X
interface on page 5-17.
The type
fenv_t
is defined to hold all the information about the current floating-point
environment:
• the rounding mode
• the exception sticky flags
• whether each exception is masked
• what handlers are installed, if any.
The type
fexcept_t
is defined to hold all the information relevant to a given set of
exceptions.
C9X also defines a macro for each rounding mode and each exception. The macros are
as follows:
FE_DIVBYZERO
FE_INEXACT
FE_INVALID
FE_OVERFLOW
FE_UNDERFLOW
FE_ALL_EXCEPT
FE_DOWNWARD
FE_TONEAREST
FE_TOWARDZERO
FE_UPWARD