fpe

Specifies floating-point exception handling for the main program at run-time.

IDE Equivalent

Windows: Floating-Point > Floating-Point Exception Handling
Linux: None

Architectures

IA-32, IntelŪ EM64T, IntelŪ ItaniumŪ architecture

Syntax

Linux: -fpen
Windows: /fpe:n

Arguments

n  Is the floating-point exception level. Possible values are 0, 1, or 3.

Default

3 The floating-point invalid, divide-by-zero, and overflow exceptions produce exceptional values and execution continues. Floating-point underflow is gradual. This setting provides full IEEE support.

Description

This option specifies floating-point exception handling for the main program at run-time. This includes whether exceptional floating-point values are allowed and how precisely run-time exceptions are reported.

The following are the kinds of floating-point exceptions affected by this option:

For example, in round-to-nearest mode, 1E30 * 1E30 overflows the single-precision floating-point range and results in a +Infinity; -1E30 * 1E30 results in a -Infinity.

Divide-by-zero occurs when the divisor is zero and the dividend is a finite nonzero number. The computed result is a correctly signed Infinity.

For example, 2.0E0/+0.0 produces a divide-by-zero exception and results in a +Infinity; -2.0E0/+0.0 produces a divide-by-zero exception and results in a -Infinity.

Underflow occurs when a computed result falls beyond the minimum range in magnitude of normalized numbers of the floating-point data type. Each floating-point type (32-, 64-, and 128-bit) has a denormalized range where very small numbers can be represented with some loss of precision. This is called gradual underflow.

For example, the lower bound for normalized single-precision float-point is approximately 1E-38, while the lower bound for denormalized single-precision float-point is approximately 1E-45. Results falling below the lower bound of the denormalized range simply become zero. 1E-30 / 1E10 underflows the normalized range but not the denormalized range so the result is the denormal value 1E-40. 1E-30 / 1E30 underflows the range and the result is zero.

Invalid occurs when operands to the basic floating-point operations or math function produce an undefined or "Quiet Nan" (QNaN) result.

Some examples include:

The fpe option controls how the following conditions are handled:

Alternate Options

None

See Also

ftz, Qftz compiler options

Building Applications: Using the Floating Point Exception Handling (-fpe) Option