다음을 통해 공유


/QIfdiv

OverviewHow Do ICompiler Options

Syntax

/QIfdiv
/QIfdiv–

The /QIfdiv option offers a workaround for the 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 than the flawed processors, and it 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. See for more information.

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

Accuracy of floating-point operations is a complex subject. 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.