diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-04-27 16:45:23 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-27 16:45:23 -0700 |
| commit | 09f1d62bdfb5794534b21d1cd9dafc4822697d60 (patch) | |
| tree | 437f6c19a6f0f16ef29fb91513176bb8aa0c91f0 /doc | |
| parent | c4eaff6665132287d05272bef8890e4607ff017c (diff) | |
| download | zig-09f1d62bdfb5794534b21d1cd9dafc4822697d60.tar.gz zig-09f1d62bdfb5794534b21d1cd9dafc4822697d60.zip | |
add new builtin function `@tan`
The reason for having `@tan` is that we already have `@sin` and `@cos`
because some targets have machine code instructions for them, but in the
case that the implementation needs to go into compiler-rt, sin, cos, and
tan all share a common dependency which includes a table of data. To
avoid duplicating this table of data, we promote tan to become a builtin
alongside sin and cos.
ZIR: The tag enum is at capacity so this commit moves
`field_call_bind_named` to be `extended`. I measured this as one of
the least used tags in the zig codebase.
Fix libc math suffix for `f32` being wrong in both stage1 and stage2.
stage1: add missing libc prefix for float functions.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/langref.html.in | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index 5cccced446..3c5de6c8d2 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -8026,7 +8026,7 @@ fn func(y: *i32) void { only rounds once, and is thus more accurate. </p> <p> - Supports Floats and Vectors of floats. + Supports {#link|Floats#} and {#link|Vectors#} of floats. </p> {#header_close#} @@ -9440,6 +9440,7 @@ fn doTheTest() !void { <a href="https://github.com/ziglang/zig/issues/4026">some float operations are not yet implemented for all float types</a>. </p> {#header_close#} + {#header_open|@cos#} <pre>{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}</pre> <p> @@ -9451,6 +9452,19 @@ fn doTheTest() !void { <a href="https://github.com/ziglang/zig/issues/4026">some float operations are not yet implemented for all float types</a>. </p> {#header_close#} + + {#header_open|@tan#} + <pre>{#syntax#}@tan(value: anytype) @TypeOf(value){#endsyntax#}</pre> + <p> + Tangent trigonometric function on a floating point number. + Uses a dedicated hardware instruction when available. + </p> + <p> + Supports {#link|Floats#} and {#link|Vectors#} of floats, with the caveat that + <a href="https://github.com/ziglang/zig/issues/4026">some float operations are not yet implemented for all float types</a>. + </p> + {#header_close#} + {#header_open|@exp#} <pre>{#syntax#}@exp(value: anytype) @TypeOf(value){#endsyntax#}</pre> <p> |
