Developer Guide and Reference

Contents

Floating-Point Environment

The floating-point environment is a collection of registers that control the behavior of the floating-point machine instructions and indicate the current floating-point status. The floating-point environment can include rounding mode controls, exception masks, flush-to-zero (
FTZ
) controls, exception status flags, and other floating-point related features.
For example, bit 15 of the
MXCSR
register enables the flush-to-zero mode, which controls the masked response to an single-instruction multiple-data (SIMD) floating-point underflow condition.
The floating-point environment affects most floating-point operations; therefore, correct configuration to meet your specific needs is important. For example, the exception mask bits define which exceptional conditions will be raised as exceptions by the processor. In general, the default floating-point environment is set by the operating system. You don't need to configure the floating-point environment unless the default floating-point environment does not suit your needs.
There are several methods available if you want to modify the default floating-point environment. For example, you can use inline assembly, compiler built-in functions, library functions, or command line options.
Changing the default floating-point environment affects runtime results only. This does not affect any calculations that are pre-computed at compile time.
If strict reproducibility and consistency are important do not change the floating point environment without also using either
-fp-model strict
(Linux* or
macOS*
) or
/fp:strict
(Windows*) option or
pragma fenv_access
.

Product and Performance Informatio