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/cbrt.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/cbrt.zig')
| -rw-r--r-- | std/math/cbrt.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/std/math/cbrt.zig b/std/math/cbrt.zig index e286f94ab4..ac6e90576e 100644 --- a/std/math/cbrt.zig +++ b/std/math/cbrt.zig @@ -1,7 +1,10 @@ const math = @import("index.zig"); const assert = @import("../debug.zig").assert; -pub fn cbrt(x: var) -> @typeOf(x) { +// TODO issue #393 +pub const cbrt = cbrt_workaround; + +pub fn cbrt_workaround(x: var) -> @typeOf(x) { const T = @typeOf(x); switch (T) { f32 => @inlineCall(cbrt32, x), @@ -106,12 +109,12 @@ fn cbrt64(x: f64) -> f64 { t + t * q } -test "cbrt" { +test "math.cbrt" { assert(cbrt(f32(0.0)) == cbrt32(0.0)); assert(cbrt(f64(0.0)) == cbrt64(0.0)); } -test "cbrt32" { +test "math.cbrt32" { const epsilon = 0.000001; assert(cbrt32(0.0) == 0.0); @@ -122,7 +125,7 @@ test "cbrt32" { assert(math.approxEq(f32, cbrt32(123123.234375), 49.748501, epsilon)); } -test "cbrt64" { +test "math.cbrt64" { const epsilon = 0.000001; assert(cbrt64(0.0) == 0.0); |
