aboutsummaryrefslogtreecommitdiff
path: root/std/math/trunc.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-06-19 14:36:33 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-06-19 14:36:33 -0400
commitc9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f (patch)
tree8ddb992d7c1b4ede1b6a99e32fad16c1a476e0c1 /std/math/trunc.zig
parent799c69910172a7248ab9db366e6e3a6556e7d626 (diff)
downloadzig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.tar.gz
zig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.zip
workaround for llvm bug
See #393 for details
Diffstat (limited to 'std/math/trunc.zig')
-rw-r--r--std/math/trunc.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/std/math/trunc.zig b/std/math/trunc.zig
index 8c2c1b0496..7311da2f15 100644
--- a/std/math/trunc.zig
+++ b/std/math/trunc.zig
@@ -1,7 +1,9 @@
const math = @import("index.zig");
const assert = @import("../debug.zig").assert;
-pub fn trunc(x: var) -> @typeOf(x) {
+pub const trunc = trunc_workaround;
+
+pub fn trunc_workaround(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(trunc32, x),
@@ -52,18 +54,18 @@ fn trunc64(x: f64) -> f64 {
}
}
-test "trunc" {
+test "math.trunc" {
assert(trunc(f32(1.3)) == trunc32(1.3));
assert(trunc(f64(1.3)) == trunc64(1.3));
}
-test "trunc32" {
+test "math.trunc32" {
assert(trunc32(1.3) == 1.0);
assert(trunc32(-1.3) == -1.0);
assert(trunc32(0.2) == 0.0);
}
-test "trunc64" {
+test "math.trunc64" {
assert(trunc64(1.3) == 1.0);
assert(trunc64(-1.3) == -1.0);
assert(trunc64(0.2) == 0.0);