Download ARM® Compiler armcc User Guide

Transcript
5 Compiler Coding Practices
5.82 <fenv.h> floating-point environment access in C99
5.82
<fenv.h> floating-point environment access in C99
The C99 standard header file <fenv.h> provides access to an IEEE 754-compliant floating-point
environment for numerical programming.
The library introduces two types and numerous macros and functions for managing and
controlling floating-point state.
The new types supported are:
•
•
fenv_t, representing the entire floating-point environment.
fexcept_t, representing the floating-point state.
New macros supported include:
•
•
•
FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW and FE_UNDERFLOW for
managing floating-point exceptions.
FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD for managing rounding in
the represented rounding direction.
FE_DFL_ENV, representing the default floating-point environment.
New functions include:
int
int
int
int
int
int
int
feclearexcept(int ex); // clear floating-point exceptions selected by ex
feraiseexcept(int ex); // raise floating point exceptions selected by ex
fetestexcept(int ex); // test floating point exceptions selected by ex
fegetround(void); // return the current rounding mode
fesetround(int mode); // set the current rounding mode given by mode
fegetenv(fenv_t *penv); return the floating-point environment in penv
fesetenv(const fenv_t *penv); // set the floating-point environment to penv
Related concepts
5.64 New library features of C99 on page 5-243.
5.78 Additional <math.h> library functions in C99 on page 5-257.
5.79 Complex numbers in C99 on page 5-258.
5.80 Boolean type and <stdbool.h> in C99 on page 5-259.
5.81 Extended integer types and functions in <inttypes.h> and <stdint.h> in C99 on page 5-260.
5.83 <stdio.h> snprintf family of functions in C99 on page 5-262.
5.84 <tgmath.h> type-generic math macros in C99 on page 5-263.
5.85 <wchar.h> wide character I/O functions in C99 on page 5-264.
Related information
Institute of Electrical and Electronics Engineers.
ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.
Non-Confidential
5-261