Improving or Restricting FP Arithmetic Precision

For most programs, specifically using options to improve floating-point precision adversely affects performance. In general, to achieve greater performance, it may be necessary to sacrifice some degree of floating-point accuracy.

If you are not sure whether your application needs the option, try compiling and running your program both with and without the option to evaluate the effects on performance versus precision.

-mp, -mp1 (Linux*) or /Op, /Qprec (Windows*)

These options improve floating-point precision, but also affect the application performance. For example, the -mp1 (Linux*) or /Qprec (Windows*) option:

The -mp (Linux) or /Op (Windows) option restricts optimization to maintain declared precision and to ensure that floating-point arithmetic conforms more closely to the ANSI and IEEE* standards. This option causes more frequent stores to memory, or disallows some data from being register candidates altogether. The Intel architecture  normally maintains floating point results in registers.

These registers are 80 bits long, and maintain greater precision than a double-precision number. When the results have to be stored to memory, rounding occurs. This can affect accuracy toward getting more of the "expected" result, but at a cost in speed.

An alternative option for IA-32, IntelŪ EM64T and ItaniumŪ architectures is the -fltconsistency (Linux) or /fltconsistency (Windows) option. The option enables improved floating-point consistency, but it might reduce execution speed. The option limits floating-point optimizations and maintains declared precision. It also disables inlining of math library functions.

On IA-32 and IntelŪ EM64T systems

Use -pc (Linux) or /Qpc (Windows) option to control floating point accuracy and rounding, along with setting various processor IEEE flags.

The -mp (Linux) or /Op (Windows) option implies -mp1 (Linux) or /Qprec (Windows), while -mp1  (Linux) or /Qprec (Windows) implies -fp-port (Linux) or /Qfp-port (Windows). The -mp (Linux) or /Op (Windows) option slows down performance the most of these three, while -fp-port (Linux) or /Qfp-port (Windows) slows performance the least of these three.

Note

Linux: -fp-port is supported on both IA-32 and IntelŪ EM64T systems.
Windows: /Qfp-port is not supported on IA-32 only.

On ItaniumŪ-based systems

See Floating-point Arithmetic Options for ItaniumŪ-based Applications.