aboutsummaryrefslogtreecommitdiff
path: root/std/math/atan.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/atan.zig
parent799c69910172a7248ab9db366e6e3a6556e7d626 (diff)
downloadzig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.tar.gz
zig-c9fc8bd802f5ed52c4cc78b93f18fc5dc9b6bb7f.zip
workaround for llvm bug
See #393 for details
Diffstat (limited to 'std/math/atan.zig')
-rw-r--r--std/math/atan.zig15
1 files changed, 9 insertions, 6 deletions
diff --git a/std/math/atan.zig b/std/math/atan.zig
index 094827e000..3e67b47ca0 100644
--- a/std/math/atan.zig
+++ b/std/math/atan.zig
@@ -1,7 +1,10 @@
const math = @import("index.zig");
const assert = @import("../debug.zig").assert;
-pub fn atan(x: var) -> @typeOf(x) {
+// TODO issue #393
+pub const atan = atan_workaround;
+
+pub fn atan_workaround(x: var) -> @typeOf(x) {
const T = @typeOf(x);
switch (T) {
f32 => @inlineCall(atan32, x),
@@ -201,12 +204,12 @@ fn atan64(x_: f64) -> f64 {
}
}
-test "atan" {
- assert(atan(f32(0.2)) == atan32(0.2));
- assert(atan(f64(0.2)) == atan64(0.2));
+test "math.atan" {
+ assert(atan_workaround(f32(0.2)) == atan32(0.2));
+ assert(atan_workaround(f64(0.2)) == atan64(0.2));
}
-test "atan32" {
+test "math.atan32" {
const epsilon = 0.000001;
assert(math.approxEq(f32, atan32(0.2), 0.197396, epsilon));
@@ -216,7 +219,7 @@ test "atan32" {
assert(math.approxEq(f32, atan32(1.5), 0.982794, epsilon));
}
-test "atan64" {
+test "math.atan64" {
const epsilon = 0.000001;
assert(math.approxEq(f64, atan64(0.2), 0.197396, epsilon));