aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-19 16:06:10 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-19 16:06:10 -0400
commitc7804277bf390eeba368e3565b2aff0cf96f86b0 (patch)
treecdf926acbc28a278ffeeb92552631a724c2da98d /doc
parent0b92d689d0e64164bb8908c807db9338d59c41ce (diff)
downloadzig-c7804277bf390eeba368e3565b2aff0cf96f86b0.tar.gz
zig-c7804277bf390eeba368e3565b2aff0cf96f86b0.zip
`@floatToInt` now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type * Also fix incorrect safety triggered for integer casting an `i32` to a `u7`. closes #1138 * adds compiler-rt function: `__floatuntidf`
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 4070ef0ac0..1bd28f9c3e 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -5035,8 +5035,12 @@ test "main" {
<pre><code class="zig">@floatToInt(comptime DestType: type, float: var) DestType</code></pre>
<p>
Converts the integer part of a floating point number to the destination type.
- To convert the other way, use {#link|@intToFloat#}. This cast is always safe.
</p>
+ <p>
+ If the integer part of the floating point number cannot fit in the destination type,
+ it invokes safety-checked {#link|Undefined Behavior#}.
+ </p>
+ {#see_also|@intToFloat#}
{#header_close#}
{#header_open|@frameAddress#}
@@ -6207,7 +6211,10 @@ comptime {
{#header_close#}
{#header_open|Wrong Union Field Access#}
<p>TODO</p>
+ {#header_close#}
+ {#header_open|Out of Bounds Float To Integer Cast#}
+ <p>TODO</p>
{#header_close#}
{#header_close#}