Standard pragmas

A standard pragma is a pragma preprocessor directive for which the C Standard defines the syntax and semantics and for which no macro replacement is performed. A standard pragma must be one of the following:

Read syntax diagramSkip visual syntax diagram>>-#pragma--STDC--+-FP_CONTRACT------+--+-ON------+--new-line--><
                  +-FENV_ACCESS------+  +-OFF-----+
                  '-CX_LIMITED_RANGE-'  '-DEFAULT-'

C onlyThe FP_CONTRACT and FENV_ACCESS pragmas are recognized and ignored.

CX_LIMITED_RANGE is described below.


The usual mathematical formulas for complex multiplication, division, and absolute value are problematic because of their treatment of infinities and because of undue overflow and underflow. The usual formulas are as follows:

(x + iy) × (u + iv) = (xu - yv) + i(yu + xv)

(x + iy)/(u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v2)

| x + iy | = sqrt(x2 + y2)

By default, the compiler uses slightly more complex but mathematically safer algorithms to implement these calculations. Where you determine that the usual mathematical formulas are safe, you can use the STDC CX_LIMITED_RANGE pragma to inform the compiler that, when the state is "on", the formulas are acceptable. In doing so, you allow the compiler to generate faster code for these computations. When the state is "off", the compiler will continue to use the safer algorithms. For details on the implementation of this pragma, see #pragma STDC CX_LIMITED RANGE.