Skip to content

Commit

Permalink
add f16 to langref
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Jun 27, 2018
1 parent 3e94347 commit 6f88ecc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions doc/langref.html.in
Expand Up @@ -367,6 +367,11 @@ pub fn main() void {
<td>for ABI compatibility with C</td>
</tr>

<tr>
<td><code>f16</code></td>
<td><code>float</code></td>
<td>16-bit floating point (10-bit mantissa) IEEE-754-2008 binary16</td>
</tr>
<tr>
<td><code>f32</code></td>
<td><code>float</code></td>
Expand Down Expand Up @@ -654,6 +659,7 @@ fn divide(a: i32, b: i32) i32 {
{#header_open|Floats#}
<p>Zig has the following floating point types:</p>
<ul>
<li><code>f16</code> - IEEE-754-2008 binary16</li>
<li><code>f32</code> - IEEE-754-2008 binary32</li>
<li><code>f64</code> - IEEE-754-2008 binary64</li>
<li><code>f128</code> - IEEE-754-2008 binary128</li>
Expand Down Expand Up @@ -3671,10 +3677,11 @@ test "implicit unsigned integer to signed integer" {
}

test "float widening" {
var a: f32 = 12.34;
var b: f64 = a;
var c: f128 = b;
assert(c == a);
var a: f16 = 12.34;
var b: f32 = a;
var c: f64 = b;
var d: f128 = c;
assert(d == a);
}
{#code_end#}
{#header_close#}
Expand Down

0 comments on commit 6f88ecc

Please sign in to comment.