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