diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-16 19:53:52 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-16 19:53:52 -0400 |
| commit | eae9634ac959bdb32c95f2acdcadde59beec23d5 (patch) | |
| tree | a15d453111951ddeb069a6f69a550918872e3862 /doc | |
| parent | a7d59086b49b0ae11a4830d2ea72b63be05fab94 (diff) | |
| download | zig-eae9634ac959bdb32c95f2acdcadde59beec23d5.tar.gz zig-eae9634ac959bdb32c95f2acdcadde59beec23d5.zip | |
langref: be clear that float types are always IEEE 754
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/langref.html.in | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index 814de721a6..039109f938 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -370,17 +370,17 @@ pub fn main() void { <tr> <td><code>f32</code></td> <td><code>float</code></td> - <td>32-bit floating point (23-bit mantissa)</td> + <td>32-bit floating point (23-bit mantissa) IEEE-754-2008 binary32</td> </tr> <tr> <td><code>f64</code></td> <td><code>double</code></td> - <td>64-bit floating point (52-bit mantissa)</td> + <td>64-bit floating point (52-bit mantissa) IEEE-754-2008 binary64</td> </tr> <tr> <td><code>f128</code></td> <td>(none)</td> - <td>128-bit floating point (112-bit mantissa)</td> + <td>128-bit floating point (112-bit mantissa) IEEE-754-2008 binary128</td> </tr> <tr> <td><code>bool</code></td> @@ -407,6 +407,16 @@ pub fn main() void { <td>(none)</td> <td>an error code</td> </tr> + <tr> + <td><code>comptime_int</code></td> + <td>(none)</td> + <td>Only allowed for {#link|comptime#}-known values. The type of integer literals.</td> + </tr> + <tr> + <td><code>comptime_float</code></td> + <td>(none)</td> + <td>Only allowed for {#link|comptime#}-known values. The type of float literals.</td> + </tr> </table> </div> {#see_also|Integers|Floats|void|Errors#} @@ -642,7 +652,18 @@ fn divide(a: i32, b: i32) i32 { {#header_close#} {#header_close#} {#header_open|Floats#} + <p>Zig has the following floating point types:</p> + <ul> + <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> + <li><code>c_longdouble</code> - matches <code>long double</code> for the target C ABI</li> + </ul> {#header_open|Float Literals#} + <p> + Float literals have type <code>comptime_float</code> which is guaranteed to hold at least all possible values + that the largest other floating point type can hold. Float literals implicitly cast to any other type. + </p> {#code_begin|syntax#} const floating_point = 123.0E+77; const another_float = 123.0; |
