共用方式為


/QIfist (Suppress _ftol) 

Suppresses the call of the helper function _ftol when a conversion from a floating-point type to an integral type is required.

/QIfist

Remarks

Note

/QIfist is only available in the compiler targeting x86; this compiler option is not available in the compilers targeting x64 or Itanium.

In addition to converting from a floating-point type to integral type, the _ftol function ensures the rounding mode of the floating-point unit (FPU) is toward zero (truncate), by setting bits 10 and 11 of the control word. This guarantees that converting from a floating-point type to an integral type occurs as described by the ANSI C standard (the fractional portion of the number is discarded). When using /QIfist, this guarantee no longer applies. The rounding mode will be one of four as documented in Intel reference manuals:

  • Round toward nearest (even number if equidistant)

  • Round toward negative infinity

  • Round toward positive infinity

  • Round toward zero

You can use the _control87, _controlfp, __control87_2 C Run-Time function to modify the rounding behavior of the FPU. The default rounding mode of the FPU is "Round toward nearest." Using /QIfist can improve the performance of your application, but not without risk. You should thoroughly test the portions of your code that are sensitive to rounding modes before relying upon code built with /QIfist in production environments.

/arch (Minimum CPU Architecture) and /QIfist can not be used on the same compiland.

Note

/QIfist is not in effect by default because the rounding bits also affect floating point to floating point rounding (which occurs after every calculation), so when you set the flags for C-style (toward zero) rounding, your floating point calculations might be different. /QIfist should not be used if your code depends upon the expected behavior of truncating the fractional portion of the floating-point number. If you are unsure, do not use /QIfist.

In Visual C++ 2005, /QIfist is deprecated. The compiler has made significant improvements in float to int conversion speed. For more information, see Deprecated Compiler Options.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  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 Also

Reference

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