aboutsummaryrefslogtreecommitdiff
path: root/std/math/tan.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/tan.zig
parent799c69910172a7248ab9db366e6e3a6556e7d626 (diff)
downloadzig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.tar.gz
zig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.zip
workaround for llvm bug
See #393 for details
Diffstat (limited to 'std/math/tan.zig')
-rw-r--r--std/math/tan.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/std/math/tan.zig b/std/math/tan.zig
index 6c86f9b38d..a2b7fddfa1 100644
--- a/std/math/tan.zig
+++ b/std/math/tan.zig
@@ -1,7 +1,9 @@
const math = @import("index.zig");
const assert = @import("../debug.zig").assert;
-pub fn tan(x: var) -> @typeOf(x) {
+pub const tan = tan_workaround;
+
+pub fn tan_workaround(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(tan32, x),
@@ -122,12 +124,12 @@ fn tan64(x_: f64) -> f64 {
r
}
-test "tan" {
+test "math.tan" {
assert(tan(f32(0.0)) == tan32(0.0));
assert(tan(f64(0.0)) == tan64(0.0));
}
-test "tan32" {
+test "math.tan32" {
const epsilon = 0.000001;
assert(math.approxEq(f32, tan32(0.0), 0.0, epsilon));
@@ -138,7 +140,7 @@ test "tan32" {
assert(math.approxEq(f32, tan32(89.123), 2.285852, epsilon));
}
-test "tan64" {
+test "math.tan64" {
const epsilon = 0.000001;
assert(math.approxEq(f64, tan64(0.0), 0.0, epsilon));