This documentation is archived and is not being maintained.

/QIfdiv (Enable Pentium FDIV Fix)

Visual Studio .NET 2003

The /QIfdiv option offers a workaround for Intel Pentium microprocessors with flawed FDIV, FPREM, FPTAN, and FPATAN instructions. Microsoft has implemented helper routines in the run-time library that perform more accurate FDIV and FPREM calculations and has provided hooks so that you can write your own helper functions for the FPTAN and FPATAN instructions.

By default, the workaround is disabled (/QIfdiv–), and the code generator emits code that is unsafe on a flawed Pentium.

If the workaround is enabled (/QIfdiv), the code generator emits fatter, safe code that tests for the processor bug and calls run-time routines instead of using the native instructions of the processor to generate correct floating-point results.

For related information, see /Op. Also see Why Floating Point Numbers May Lose Precision.

Note that replacing your processor is another solution to the computation flaws. Contact Intel Corporation for more information.

Most people need not worry about this situation, either because they do not use floating-point at all, or because they do not need an extremely high degree of accuracy. Those who need to be concerned are urged to make sure they understand the issues rather than simply assume that the tools will "just work."

Performance testing of this workaround indicates a worst case penalty is approximately 10% on a Pentium without the flaw, 2x on a flawed Pentium; and the realistic penalty is <1% on a Pentium without the flaw, and 10% on a flawed Pentium. As always, the results may vary. That is, you may see no slowdown in a realistic program, or you may see 2x in a realistic program. If performance is an issue for you, measure it and see what your actual results are. For more information, see Optimizing Your Code.

This fix has been tested extensively. However, as with all software, there is always a possibility that errors remain. You should rigorously test your applications to ensure correctness.

Accuracy of floating-point operations is complex. Even with an accurate set of "atomic" operations, such as +, -, *, /, a program can give unexpected results. The C/C++ standard does not, in general, guarantee a specific order of evaluation for expressions, nor does it guarantee that intermediate results will be forced to a particular precision, so two programs that are logically equivalent on the surface may yield different results.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Command Line property page.
  4. Type the compiler option in the Additional Options box.

To set this compiler option programmatically

See AdditionalOptions.

See Also

/Q Options (Low-Level Operations) | Compiler Options | Setting Compiler Options