Eric Fleegal's WebLog

. . . .

FP Whitepaper Addition: Setting the floating-point semantic mode on a function-by-function basis in VC8.0

The command-line switches -fp:precise, -fp:strict etc. are simply shorthand for setting the four different floating-point options (these are explained in the whitepaper).  To explicitly select a particular floating-point semantic mode on a function-by-function basis, enable or disable each of the four floating-point option pragmas as described in the following table: 

 

 

float_control(precise)

float_control(except)

fp_contract

fenv_access

-fp:strict

on

on

off

on

-fp:strict -fp:except-

on

off

off

on

-fp:precise

on

off

on

off

-fp:precise –fp:except

on

on

on

off

-fp:fast

off

off

on

off

 

For example, the following explicitly enables fp:fast semantics.  Note that exception semantics must be turned-off before turning off “precise” semantics.

#pragma float_control( except, off )   // disable exception semantics

#pragma float_control( precise, off )  // disable precise semantics

#pragma fp_contract(on)                // enable contractions

#pragma fenv_access(off)               // disable fpu environment sensitivity

 

 

Published Tuesday, May 18, 2004 5:35 PM by ericflee

Comments

 

仪表 said:

VC8 Is Visual C++ .NET 2003??
When can I use these command-line switches?
June 28, 2004 6:31 PM
 

Eric Fleegal said:

VC7.1 is in VS .NET 2003
These switches are available in VC8.0 (in beta now)
July 1, 2004 1:46 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker