Floating-point Arithmetic Precision

Options for IA-32 and Itanium(TM)-based Systems

Option Description
-mp The -mp option restricts optimization to maintain declared precision and to ensure that floating-point arithmetic conforms more closely to the ANSI and IEEE standards. For most programs, specifying this option adversely affects performance. If you are not sure whether your application needs this option, try compiling and running your program both with and without it to evaluate the effects on performance versus precision. Specifying this option has the following effects on program compilation:
  • User variables declared as floating-point types are not assigned to registers.

  • Whenever an expression is spilled, it is spilled as 80 bits (extended precision), not 64 bits (double precision).

  • Floating-point arithmetic comparisons conform to IEEE 754 except for NaN behavior.

  • The exact operations specified in the code are performed. For example, division is never changed to multiplication by the reciprocal.

  • The compiler performs floating-point operations in the order specified without reassociation.

  • The compiler does not perform the constant-folding optimization on floating-point values. Constant folding also eliminates any multiplication by 1, division by 1, and addition or subtraction of 0. For example, code that adds 0.0 to a number is executed exactly as written. Compile-time floating-point arithmetic is not performed to ensure that floating-point exceptions are also maintained.

  • Floating-point operations conform to ANSI C. When assignments to type float and double are made, the precision is rounded from 80 bits (extended) down to 32 bits (float) or 64 bits ( double ). When you do not specify -Op, the extra bits of precision are not always rounded before the variable is reused.

  • The -nolib_inline option, which disables inline functions expansion, is used.

Note: The -nolib_inline and -mp options are active by default when you choose the -Xc (strict ANSI C conformance) option.

-long_double Use -long_double to change the size of the long double type to 80 bits. The Intel compiler's defalt long double type is 64 bits in size, the same as the double type. This option introduces a number of incompatibilities with other files compiled without this option and with calls to library routines. Therefore, Intel recommends that the use of long double variables be local to a single file when you compile with this option.

Options for IA-32 Only

Option Description
-mp1 Use the -mp1 option to improve floating-point precision. -mp1 disables fewer optimizations and has less impact on performance than -mp.
-prec_div With some optimizations, such as -xK and -xW, the Intel® C++ Compiler changes floating-point division computations into multiplication by the reciprocal of the denominator. For example, A/B is computed as A x (1/B) to improve the speed of the computation. However, for values of B greater than 2126, the value of 1/B is "flushed" (changed) to 0. When it is important to maintain the value of 1/B, use -prec_div to disable the floating-point division-to-multiplication optimization. The result of -prec_div is greater accuracy with some loss of performance.
-pcn Use the -pcn option to enable floating-point significand precision control. Some floating-point algorithms are sensitive to the accuracy of the significand or fractional part of the floating-point value. For example, iterative operations like division and finding the square root can run faster if you lower the precision with the -pcn option. Set n to one of the following values to round the significand to the indicated number of bits:   The default value for n is 64, indicating double precision. This option allows full optimization. Using this option does not have the negative performance impact of using the -mp option because only the fractional part of the floating-point value is affected. The range of the exponent is not affected. The -pcn option causes the compiler to change the floating point precision control when the main() function is compiled. The program that uses -pcn must use main() as its entry point, and the file containing main() must be compiled with -pcn.
-rcd The Intel compiler uses the -rcd option to improve the performance of code that requires floating-point-to-integer conversions. The optimization is obtained by controlling the change of the rounding mode. The system default floating point rounding mode is round-to-nearest. This means that values are rounded during floating point calculations. However, the C language requires floating point values to be truncated when a conversion to an integer is involved. To do this, the compiler must change the rounding mode to truncation before each floating point-to-integer conversion and change it back afterwards. The -rcd option disables the change to truncation of the rounding mode for all floating point calculations, including floating point-to-integer conversions. Turning on this option can improve performance, but floating point conversions to integer will not conform to C semantics.