authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-16 19:53:52-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-16 19:53:52-04:00
logeae9634ac959bdb32c95f2acdcadde59beec23d5
treea15d453111951ddeb069a6f69a550918872e3862
parenta7d59086b49b0ae11a4830d2ea72b63be05fab94

langref: be clear that float types are always IEEE 754


1 files changed, 24 insertions(+), 3 deletions(-)

doc/langref.html.in+24-3
......@@ -370,17 +370,17 @@ pub fn main() void {
370370 <tr>
371371 <td><code>f32</code></td>
372372 <td><code>float</code></td>
373 <td>32-bit floating point (23-bit mantissa)</td>
373 <td>32-bit floating point (23-bit mantissa) IEEE-754-2008 binary32</td>
374374 </tr>
375375 <tr>
376376 <td><code>f64</code></td>
377377 <td><code>double</code></td>
378 <td>64-bit floating point (52-bit mantissa)</td>
378 <td>64-bit floating point (52-bit mantissa) IEEE-754-2008 binary64</td>
379379 </tr>
380380 <tr>
381381 <td><code>f128</code></td>
382382 <td>(none)</td>
383 <td>128-bit floating point (112-bit mantissa)</td>
383 <td>128-bit floating point (112-bit mantissa) IEEE-754-2008 binary128</td>
384384 </tr>
385385 <tr>
386386 <td><code>bool</code></td>
......@@ -407,6 +407,16 @@ pub fn main() void {
407407 <td>(none)</td>
408408 <td>an error code</td>
409409 </tr>
410 <tr>
411 <td><code>comptime_int</code></td>
412 <td>(none)</td>
413 <td>Only allowed for {#link|comptime#}-known values. The type of integer literals.</td>
414 </tr>
415 <tr>
416 <td><code>comptime_float</code></td>
417 <td>(none)</td>
418 <td>Only allowed for {#link|comptime#}-known values. The type of float literals.</td>
419 </tr>
410420 </table>
411421 </div>
412422 {#see_also|Integers|Floats|void|Errors#}
......@@ -642,7 +652,18 @@ fn divide(a: i32, b: i32) i32 {
642652 {#header_close#}
643653 {#header_close#}
644654 {#header_open|Floats#}
655 <p>Zig has the following floating point types:</p>
656 <ul>
657 <li><code>f32</code> - IEEE-754-2008 binary32</li>
658 <li><code>f64</code> - IEEE-754-2008 binary64</li>
659 <li><code>f128</code> - IEEE-754-2008 binary128</li>
660 <li><code>c_longdouble</code> - matches <code>long double</code> for the target C ABI</li>
661 </ul>
645662 {#header_open|Float Literals#}
663 <p>
664 Float literals have type <code>comptime_float</code> which is guaranteed to hold at least all possible values
665 that the largest other floating point type can hold. Float literals implicitly cast to any other type.
666 </p>
646667 {#code_begin|syntax#}
647668const floating_point = 123.0E+77;
648669const another_float = 123.0;