add f16 to langref

This commit is contained in:
Andrew Kelley 2018-06-27 12:59:12 -04:00
parent 3e94347e61
commit 6f88ecc9b6

View File

@ -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>
@ -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>
@ -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#}