| author | |
| committer | |
| log | 65997f816bd7aa48f585c61e4d966253d9947ec5 |
| tree | 9d684e2a3bae616b1eb4841fb5dc8072cae738b2 |
| parent | 726674b2bd0ac8159c961a944012b096d08e5615 |
| parent | be51511d295269851ea4128f0fd3db49fe96a661 |
| signature | Commit is signed but in an unrecognized format. |
3 files changed, 12 insertions(+), 3 deletions(-)
doc/langref.html.in+1-1| ... | @@ -3787,7 +3787,7 @@ test "fn reflection" { | ... | @@ -3787,7 +3787,7 @@ test "fn reflection" { |
| 3787 | However right now it is hard coded to be a {#syntax#}u16{#endsyntax#}. See <a href="https://github.com/ziglang/zig/issues/786">#768</a>. | 3787 | However right now it is hard coded to be a {#syntax#}u16{#endsyntax#}. See <a href="https://github.com/ziglang/zig/issues/786">#768</a>. |
| 3788 | </p> | 3788 | </p> |
| 3789 | <p> | 3789 | <p> |
| 3790 | You can {#link|implicitly cast|Implicit Casts#} an error from a subset to its superset: | 3790 | You can {#link|implicitly cast|Implicit Casts#} an error from a subset to a superset: |
| 3791 | </p> | 3791 | </p> |
| 3792 | {#code_begin|test#} | 3792 | {#code_begin|test#} |
| 3793 | const std = @import("std"); | 3793 | const std = @import("std"); |
std/c/darwin.zig+1-1| ... | @@ -37,7 +37,7 @@ const mach_hdr = if (@sizeOf(usize) == 8) mach_header_64 else mach_header; | ... | @@ -37,7 +37,7 @@ const mach_hdr = if (@sizeOf(usize) == 8) mach_header_64 else mach_header; |
| 37 | pub extern "c" var _mh_execute_header: mach_hdr = undefined; | 37 | pub extern "c" var _mh_execute_header: mach_hdr = undefined; |
| 38 | comptime { | 38 | comptime { |
| 39 | if (std.os.darwin.is_the_target) { | 39 | if (std.os.darwin.is_the_target) { |
| 40 | @export("__mh_execute_header", _mh_execute_header, .Weak); | 40 | @export("_mh_execute_header", _mh_execute_header, .Weak); |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 |
std/math.zig+10-1| ... | @@ -482,7 +482,16 @@ fn testAbsInt() void { | ... | @@ -482,7 +482,16 @@ fn testAbsInt() void { |
| 482 | testing.expect((absInt(i32(10)) catch unreachable) == 10); | 482 | testing.expect((absInt(i32(10)) catch unreachable) == 10); |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | pub const absFloat = @import("fabs.zig").fabs; | 485 | pub const absFloat = fabs; |
| 486 | |||
| 487 | test "math.absFloat" { | ||
| 488 | testAbsFloat(); | ||
| 489 | comptime testAbsFloat(); | ||
| 490 | } | ||
| 491 | fn testAbsFloat() void { | ||
| 492 | testing.expect(absFloat(f32(-10.05)) == 10.05); | ||
| 493 | testing.expect(absFloat(f32(10.05)) == 10.05); | ||
| 494 | } | ||
| 486 | 495 | ||
| 487 | pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T { | 496 | pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T { |
| 488 | @setRuntimeSafety(false); | 497 | @setRuntimeSafety(false); |