diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-13 15:46:34 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-13 15:46:34 -0400 |
| commit | 7c3636aaa38e8efa77b73ba94362802517ea739e (patch) | |
| tree | 68aa09c19e1ccd907ffb286cba02c7aab9399738 /doc | |
| parent | 9ac9633b105b737f2700f1930768a6ea6d4d75c5 (diff) | |
| download | zig-7c3636aaa38e8efa77b73ba94362802517ea739e.tar.gz zig-7c3636aaa38e8efa77b73ba94362802517ea739e.zip | |
remove the scope parameter of setFloatMode
also document that scopes inherit this value. See #367
See #1283
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/langref.html.in | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index 6f12f0339f..aefbfc5650 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -734,7 +734,7 @@ export fn foo_strict(x: f64) f64 { } export fn foo_optimized(x: f64) f64 { - @setFloatMode(this, builtin.FloatMode.Optimized); + @setFloatMode(builtin.FloatMode.Optimized); return x + big - big; } {#code_end#} @@ -6030,18 +6030,21 @@ test "foo" { {#see_also|comptime#} {#header_close#} {#header_open|@setFloatMode#} - <pre><code class="zig">@setFloatMode(scope, mode: @import("builtin").FloatMode)</code></pre> + <pre><code class="zig">@setFloatMode(mode: @import("builtin").FloatMode)</code></pre> <p> - Sets the floating point mode for a given scope. Possible values are: + Sets the floating point mode of the current scope. Possible values are: </p> {#code_begin|syntax#} pub const FloatMode = enum { - Optimized, Strict, + Optimized, }; {#code_end#} <ul> <li> + <code>Strict</code> (default) - Floating point operations follow strict IEEE compliance. + </li> + <li> <code>Optimized</code> - Floating point operations may do all of the following: <ul> <li>Assume the arguments and result are not NaN. Optimizations are required to retain defined behavior over NaNs, but the value of the result is undefined.</li> @@ -6053,10 +6056,11 @@ pub const FloatMode = enum { </ul> This is equivalent to <code>-ffast-math</code> in GCC. </li> - <li> - <code>Strict</code> (default) - Floating point operations follow strict IEEE compliance. - </li> </ul> + <p> + The floating point mode is inherited by child scopes, and can be overridden in any scope. + You can set the floating point mode in a struct or module scope by using a comptime block. + </p> {#see_also|Floating Point Operations#} {#header_close#} {#header_open|@setGlobalLinkage#} |
