Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
/Op (Improve Float Consistency)

/Op (Improve Float Consistency)

Visual Studio .NET 2003

This option improves the consistency of floating-point tests for equality and inequality by disabling optimizations that could change the precision of floating-point calculations.

By default, the compiler uses the coprocessor's 80-bit registers to hold the intermediate results of floating-point calculations. This increases program speed and decreases program size. However, because the calculation involves floating-point data types that are represented in memory by less than 80 bits, carrying the extra bits of precision (80 bits minus the number of bits in a smaller floating-point type) through a lengthy calculation can produce inconsistent results.

With /Op, the compiler loads data from memory prior to each floating-point operation and, if assignment occurs, writes the results back to memory upon completion. Loading the data prior to each operation guarantees that the data does not retain any significance greater than the capacity of its type.

A program compiled with /Op may be slower and larger than one compiled without /Op.

Note   The /Op option disables inline generation of floating-point functions. The standard run-time library routines are used instead. For more information, see the /Oi option.

Selecting /Za (ANSI compatibility) selects /Op by default. Using /Op improves the consistency of floating-point tests for equality and inequality, which is required for strict ANSI conformance. The /Op– option overrides this default.

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 Optimization property page.
  4. Modify the Floating-Point Consistency property.

To set this compiler option programmatically

See ImproveFloatingPointConsistency Property.

See Also

/O Options (Optimize Code) | Compiler Options | Setting Compiler Options | IEEE Floating-Point Representation and Microsoft Languages | Why Floating Point Numbers May Lose Precision

© 2015 Microsoft