You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/preprocessor/fenv-access.md
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
---
2
2
title: "fenv_access pragma"
3
-
ms.date: "08/29/2019"
3
+
description: "Describes the usage and effects of the fenv_access pragma directive. The fenv_access directive controls access to the floating-point environment at runtime."
@@ -19,6 +20,14 @@ By default, **fenv_access** is **off**. If the compiler can assume that your cod
19
20
20
21
For more information on floating-point behavior, see [/fp (Specify Floating-Point Behavior)](../build/reference/fp-specify-floating-point-behavior.md).
21
22
23
+
There are restrictions on the ways you can use the **fenv_access** pragma in combination with other floating-point settings:
24
+
25
+
- You can't enable **fenv_access** unless precise semantics are enabled. Precise semantics can be enabled either by the [float_control](float-control.md) pragma, or by using the [/fp:precise](../build/reference/fp-specify-floating-point-behavior.md) or [/fp:strict](../build/reference/fp-specify-floating-point-behavior.md) compiler options. The compiler defaults to **/fp:precise** if no other floating-point command-line option is specified.
26
+
27
+
- You can't use **float_control** to disable precise semantics when **fenv_access(on)** is set.
28
+
29
+
These restrictions mean the order of some floating-point pragmas is significant. For more information, see [float_control](float-control.md).
30
+
22
31
The kinds of optimizations that are subject to **fenv_access** are:
Copy file name to clipboardExpand all lines: docs/preprocessor/float-control.md
+38-25Lines changed: 38 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: "float_control pragma"
3
+
description: "Describes the usage and effects of the float_control pragma directive. The float_control directive controls the state of floating-point precise semantics and exception semantics at runtime."
Specifies floating-point behavior, which can be **precise**, **strict**, or **except**. The setting can either be **on** or **off**. For information on how these settings differ from the similarly named compiler options, see the Remarks section.
22
+
**precise**, **on** | **off**, **push**\
23
+
Specifies whether to enable (**on**) or disable (**off**) precise floating-point semantics. For information on how this option differs from the similarly named **/fp:precise**compiler option, see the Remarks section. If the optional **push** token is added, the current setting for **float_control** is pushed on to the internal compiler stack.
22
24
23
-
When **strict**, the settings for both **strict** and **except** are specified by the **on** or **off** setting.
25
+
**except**, **on** | **off**, **push**\
26
+
Specifies whether to enable (**on**) or disable (**off**) floating-point exception semantics. For information on how this option differs from the similarly named **/fp:except** compiler option, see the Remarks section. If the optional **push** token is added, the current setting for **float_control** is pushed on to the internal compiler stack.
24
27
25
-
If the optional **push**token is added, the current setting for**float_control** is pushed on to the internal compiler stack.
28
+
**except**can only be set to **on** when**precise** is also set to **on**.
26
29
27
30
**push**\
28
-
Push the current **float_control** setting on to the internal compiler stack
31
+
Pushes the current **float_control** setting on to the internal compiler stack.
29
32
30
33
**pop**\
31
-
Removes the **float_control** setting from the top of the internal compiler stack and makes that the new **float_control** setting.
34
+
Removes the **float_control** setting from the top of the internal compiler stack, and makes that the new **float_control** setting.
32
35
33
36
## Remarks
34
37
35
-
The **strict**option is effectively the same as the combination of **precise** and **except**. If you set **strict** on or off, it also sets **except** on or off. **except** can only be set to**on**when **precise** or **strict** is also set to **on**.
38
+
The **precise**and **except** options don't have exactly the same behavior as the [/fp](../build/reference/fp-specify-floating-point-behavior.md) compiler options of the same names. The **float_control** pragma only governs part of the floating-point behavior. It must be combined with [fp_contract](../preprocessor/fp-contract.md) and [fenv_access](../preprocessor/fenv-access.md) pragmas to recreate the**/fp**compiler options. The following table shows the equivalent pragma settings for each compiler option:
36
39
37
-
The **precise**, **strict**, and **except** options don't have exactly the same behavior as the [/fp](../build/reference/fp-specify-floating-point-behavior.md) compiler options of the same names. The **float_control** pragma only governs part of the floating-point behavior. It must be combined with [fp_contract](../preprocessor/fp-contract.md) and [fenv_access](../preprocessor/fenv-access.md) pragmas to recreate the `/fp` compiler options. The following table shows the equivalent pragma settings for each compiler option:
In other words, you must use several pragmas in combination to emulate the **/fp:fast**, **/fp:precise**, **/fp:strict**, and **/fp:except** command-line options.
49
+
50
+
There are restrictions on the ways you can use the **float_control** and [fenv_access](../preprocessor/fenv-access.md) floating-point pragmas in combination:
51
+
52
+
- You can only use **float_control** to set **except** to **on** if precise semantics are enabled. Precise semantics can be enabled either by the **float_control** pragma, or by using the **/fp:precise** or **/fp:strict** compiler options.
53
+
54
+
- You can't use **float_control** to turn **precise** off when exception semantics are enabled, whether by a **float_control** pragma or a **/fp:except** compiler option.
55
+
56
+
- You can't enable [fenv_access](../preprocessor/fenv-access.md) unless precise semantics are enabled, whether by a **float_control** pragma or a compiler option.
44
57
45
-
For example, you must use several pragmas in combination to change from `/fp:fast` behavior to `/fp:precise` or `/fp:strict` and back again. To recreate [/fp:strict](../build/reference/fp-specify-floating-point-behavior.md), you must set **float_control(precise, on)**, **fenv_access(on)**, **float_control(except, on)**, and **fp_contract(off)**.
58
+
- You can't use **float_control**to turn **precise** off when **fenv_access(on)** is set.
46
59
47
-
You can't use **float_control** to turn **precise** off when **except** is on. Similarly, **precise** can't be turned off when [fenv_access](../preprocessor/fenv-access.md) is on. That means, the order of some floating-point pragmas is significant. To go from a strict model to a fast model by using the **float_control**pragma, use the following code:
60
+
These restrictions mean the order of some floating-point pragmas is significant. To go from a fast model to a strict model using the **float_control**and related pragmas, use the following code:
0 commit comments