diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-06-19 14:36:33 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-06-19 14:36:33 -0400 |
| commit | c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f (patch) | |
| tree | 8ddb992d7c1b4ede1b6a99e32fad16c1a476e0c1 /std/math/round.zig | |
| parent | 799c69910172a7248ab9db366e6e3a6556e7d626 (diff) | |
| download | zig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.tar.gz zig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.zip | |
workaround for llvm bug
See #393 for details
Diffstat (limited to 'std/math/round.zig')
| -rw-r--r-- | std/math/round.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/std/math/round.zig b/std/math/round.zig index 41768b7ba0..dfdce3db9e 100644 --- a/std/math/round.zig +++ b/std/math/round.zig @@ -2,7 +2,10 @@ const builtin = @import("builtin"); const assert = @import("../debug.zig").assert; const math = @import("index.zig"); -pub fn round(x: var) -> @typeOf(x) { +// TODO issue #393 +pub const round = round_workaround; + +pub fn round_workaround(x: var) -> @typeOf(x) { const T = @typeOf(x); switch (T) { f32 => @inlineCall(round32, x), @@ -85,19 +88,19 @@ fn round64(x_: f64) -> f64 { } } -test "round" { +test "math.round" { assert(round(f32(1.3)) == round32(1.3)); assert(round(f64(1.3)) == round64(1.3)); } -test "round32" { +test "math.round32" { assert(round32(1.3) == 1.0); assert(round32(-1.3) == -1.0); assert(round32(0.2) == 0.0); assert(round32(1.8) == 2.0); } -test "round64" { +test "math.round64" { assert(round64(1.3) == 1.0); assert(round64(-1.3) == -1.0); assert(round64(0.2) == 0.0); |
