| ... | ... | @@ -367,6 +367,11 @@ pub fn main() void { |
| 367 | 367 | <td>for ABI compatibility with C</td> |
| 368 | 368 | </tr> |
| 369 | 369 | |
| 370 | <tr> |
| 371 | <td><code>f16</code></td> |
| 372 | <td><code>float</code></td> |
| 373 | <td>16-bit floating point (10-bit mantissa) IEEE-754-2008 binary16</td> |
| 374 | </tr> |
| 370 | 375 | <tr> |
| 371 | 376 | <td><code>f32</code></td> |
| 372 | 377 | <td><code>float</code></td> |
| ... | ... | @@ -654,6 +659,7 @@ fn divide(a: i32, b: i32) i32 { |
| 654 | 659 | {#header_open|Floats#} |
| 655 | 660 | <p>Zig has the following floating point types:</p> |
| 656 | 661 | <ul> |
| 662 | <li><code>f16</code> - IEEE-754-2008 binary16</li> |
| 657 | 663 | <li><code>f32</code> - IEEE-754-2008 binary32</li> |
| 658 | 664 | <li><code>f64</code> - IEEE-754-2008 binary64</li> |
| 659 | 665 | <li><code>f128</code> - IEEE-754-2008 binary128</li> |
| ... | ... | @@ -3671,10 +3677,11 @@ test "implicit unsigned integer to signed integer" { |
| 3671 | 3677 | } |
| 3672 | 3678 | |
| 3673 | 3679 | test "float widening" { |
| 3674 | | var a: f32 = 12.34; |
| 3675 | | var b: f64 = a; |
| 3676 | | var c: f128 = b; |
| 3677 | | assert(c == a); |
| 3680 | var a: f16 = 12.34; |
| 3681 | var b: f32 = a; |
| 3682 | var c: f64 = b; |
| 3683 | var d: f128 = c; |
| 3684 | assert(d == a); |
| 3678 | 3685 | } |
| 3679 | 3686 | {#code_end#} |
| 3680 | 3687 | {#header_close#} |