Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ziglang/zig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a7d59086b49b
Choose a base ref
...
head repository: ziglang/zig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3ee4d23ebdd1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 16, 2018

  1. Copy the full SHA
    eae9634 View commit details
  2. Copy the full SHA
    3ee4d23 View commit details
Showing with 34 additions and 5 deletions.
  1. +24 −3 doc/langref.html.in
  2. +1 −0 std/debug/index.zig
  3. +9 −2 std/os/file.zig
27 changes: 24 additions & 3 deletions doc/langref.html.in
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions std/debug/index.zig
Original file line number Diff line number Diff line change
@@ -639,6 +639,7 @@ const ParseFormValueError = error{
Unexpected,
InvalidDebugInfo,
EndOfFile,
IsDir,
OutOfMemory,
};

11 changes: 9 additions & 2 deletions std/os/file.zig
Original file line number Diff line number Diff line change
@@ -311,9 +311,15 @@ pub const File = struct {
}
}

pub const ReadError = error{};
pub const ReadError = error{
BadFd,
Io,
IsDir,

Unexpected,
};

pub fn read(self: *File, buffer: []u8) !usize {
pub fn read(self: *File, buffer: []u8) ReadError!usize {
if (is_posix) {
var index: usize = 0;
while (index < buffer.len) {
@@ -326,6 +332,7 @@ pub const File = struct {
posix.EFAULT => unreachable,
posix.EBADF => return error.BadFd,
posix.EIO => return error.Io,
posix.EISDIR => return error.IsDir,
else => return os.unexpectedErrorPosix(read_err),
}
}