From c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 19 Jun 2017 14:36:33 -0400 Subject: workaround for llvm bug See #393 for details --- std/math/round.zig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'std/math/round.zig') 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); -- cgit v1.2.3