# fpe

Allows some control over floating-point exception handling for the main program at run-time.

## Syntax

Linux: | -fpe n

macOS: | -fpe n

Windows: | /fpe:n

## Arguments

n | Specifies the floating-point exception handling level. Possible values are:
0 | Floating-point invalid, divide-by-zero, and overflow exceptions are enabled throughout the application when the main program is compiled with this value. If any such exceptions occur, execution is aborted. This option causes subnormal floating-point results to be set to zero. Underflow results will also be set to zero, unless you override this by explicitly specifying option -no-ftz or -fp-model precise (Linux* and macOS) or option /Qftz- or /fp:precise (Windows*). Underflow results from SSE instructions, as well as x87 instructions, will be set to zero. By contrast, option [Q]ftz only sets SSE underflow results to zero. Sets option -fp-speculation=strict (Linux* and macOS) or /Qfp-speculation:strict (Windows*) for any program unit compiled with -fpe0 (Linux* and macOS) or /fpe:0 (Windows*). This disables certain optimizations in cases where speculative execution of floating-point operations could lead to floating-point exceptions that would not occur in the absence of speculation. For example, this may prevent the vectorization of some loops containing conditionals. Disables certain optimizations that generate calls to the Short Vector Math Library that could lead to floating-point exceptions for extreme input arguments that would not occur if libm was called instead. For example, this may prevent the vectorization of some loops containing calls to transcendental math functions. To get more detailed location information about where the error occurred, use option traceback. ### Note If you have more than one module, you must build each module, including the main module, with value fpe0 (Linux) or fpe:0 (Windows) to avoid floating-point exceptions that may occur within the modules.
1 | All floating-point exceptions are disabled. Underflow results from SSE instructions, as well as x87 instructions, will be set to zero.
3 | All floating-point exceptions are disabled. Floating-point underflow is gradual, unless you explicitly specify a compiler option that enables flush-to-zero, such as [Q]ftz, O3, or O2. This setting provides full IEEE support.

## Default

-fpe3 or /fpe:3 | All floating-point exceptions are disabled. Floating-point underflow is gradual, unless you explicitly specify a compiler option that enables flush-to-zero.

## Description

This option allows some control over floating-point exception handling at run-time. This includes whether exceptional floating-point values are allowed and how precisely run-time exceptions are reported.

The fpe option affects how the following conditions are handled:

- When floating-point calculations result in a divide by zero, overflow, or invalid operation.

- When floating-point calculations result in an underflow.

- When a subnormal number or other exceptional number (positive infinity, negative infinity, or a NaN) is present in an arithmetic expression.

When enabled exceptions occur, execution is aborted and the cause of the abort reported to the user. If compiler option traceback is specified at compile time, detailed information about the location of the abort is also reported.

This option does not enable underflow exceptions, input subnormal exceptions, or inexact exceptions.

## IDE Equivalent

Visual Studio: Floating-Point > Floating-Point Exception Handling

## Alternate Options

None

Parent topic: Floating-Point Options

## See Also

fpe-all compiler option
ftz, Qftz compiler option
fp-model, fp compiler option
fp-speculation, Qfp-speculation compiler option
traceback compiler option