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 {...@@ -370,17 +370,17 @@ pub fn main() void {
370 <tr>370 <tr>
371 <td><code>f32</code></td>371 <td><code>f32</code></td>
372 <td><code>float</code></td>372 <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>
374 </tr>374 </tr>
375 <tr>375 <tr>
376 <td><code>f64</code></td>376 <td><code>f64</code></td>
377 <td><code>double</code></td>377 <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>
379 </tr>379 </tr>
380 <tr>380 <tr>
381 <td><code>f128</code></td>381 <td><code>f128</code></td>
382 <td>(none)</td>382 <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>
384 </tr>384 </tr>
385 <tr>385 <tr>
386 <td><code>bool</code></td>386 <td><code>bool</code></td>
...@@ -407,6 +407,16 @@ pub fn main() void {...@@ -407,6 +407,16 @@ pub fn main() void {
407 <td>(none)</td>407 <td>(none)</td>
408 <td>an error code</td>408 <td>an error code</td>
409 </tr>409 </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>
410 </table>420 </table>
411 </div>421 </div>
412 {#see_also|Integers|Floats|void|Errors#}422 {#see_also|Integers|Floats|void|Errors#}
...@@ -642,7 +652,18 @@ fn divide(a: i32, b: i32) i32 {...@@ -642,7 +652,18 @@ fn divide(a: i32, b: i32) i32 {
642 {#header_close#}652 {#header_close#}
643 {#header_close#}653 {#header_close#}
644 {#header_open|Floats#}654 {#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>
645 {#header_open|Float Literals#}662 {#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>
646 {#code_begin|syntax#}667 {#code_begin|syntax#}
647const floating_point = 123.0E+77;668const floating_point = 123.0E+77;
648const another_float = 123.0;669const another_float = 123.0;