| author | |
| committer | |
| log | b8ed0cb3741533e036ee05faa165d2f0c49064f4 |
| tree | b49d168bb11b5fe40748a38cb758ddf6e68d7e04 |
| parent | d7a539906d2dd49872abb161f3d3364c9641ccd2 |
now that we depend on LLVM 5.0.0 we can remove the
workaround.
closes #39338 files changed, 51 insertions(+), 163 deletions(-)
std/math/acos.zig+3-6| ... | @@ -5,10 +5,7 @@ | ... | @@ -5,10 +5,7 @@ |
| 5 | const math = @import("index.zig"); | 5 | const math = @import("index.zig"); |
| 6 | const assert = @import("../debug.zig").assert; | 6 | const assert = @import("../debug.zig").assert; |
| 7 | 7 | ||
| 8 | pub const acos = acos_workaround; | 8 | pub fn acos(x: var) -> @typeOf(x) { |
| 9 | |||
| 10 | // TODO issue #393 | ||
| 11 | pub fn acos_workaround(x: var) -> @typeOf(x) { | ||
| 12 | const T = @typeOf(x); | 9 | const T = @typeOf(x); |
| 13 | switch (T) { | 10 | switch (T) { |
| 14 | f32 => @inlineCall(acos32, x), | 11 | f32 => @inlineCall(acos32, x), |
| ... | @@ -145,8 +142,8 @@ fn acos64(x: f64) -> f64 { | ... | @@ -145,8 +142,8 @@ fn acos64(x: f64) -> f64 { |
| 145 | } | 142 | } |
| 146 | 143 | ||
| 147 | test "math.acos" { | 144 | test "math.acos" { |
| 148 | assert(acos_workaround(f32(0.0)) == acos32(0.0)); | 145 | assert(acos(f32(0.0)) == acos32(0.0)); |
| 149 | assert(acos_workaround(f64(0.0)) == acos64(0.0)); | 146 | assert(acos(f64(0.0)) == acos64(0.0)); |
| 150 | } | 147 | } |
| 151 | 148 | ||
| 152 | test "math.acos32" { | 149 | test "math.acos32" { |
std/math/acosh.zig+3-6| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | pub const acosh = acosh_workaround; | 9 | pub fn acosh(x: var) -> @typeOf(x) { |
| 10 | |||
| 11 | // TODO issue #393 | ||
| 12 | pub fn acosh_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(acosh32, x), | 12 | f32 => @inlineCall(acosh32, x), |
| ... | @@ -56,8 +53,8 @@ fn acosh64(x: f64) -> f64 { | ... | @@ -56,8 +53,8 @@ fn acosh64(x: f64) -> f64 { |
| 56 | } | 53 | } |
| 57 | 54 | ||
| 58 | test "math.acosh" { | 55 | test "math.acosh" { |
| 59 | assert(acosh_workaround(f32(1.5)) == acosh32(1.5)); | 56 | assert(acosh(f32(1.5)) == acosh32(1.5)); |
| 60 | assert(acosh_workaround(f64(1.5)) == acosh64(1.5)); | 57 | assert(acosh(f64(1.5)) == acosh64(1.5)); |
| 61 | } | 58 | } |
| 62 | 59 | ||
| 63 | test "math.acosh32" { | 60 | test "math.acosh32" { |
std/math/asin.zig+3-6| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | pub const asin = asin_workaround; | 9 | pub fn asin(x: var) -> @typeOf(x) { |
| 10 | |||
| 11 | // TODO issue #393 | ||
| 12 | pub fn asin_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(asin32, x), | 12 | f32 => @inlineCall(asin32, x), |
| ... | @@ -138,8 +135,8 @@ fn asin64(x: f64) -> f64 { | ... | @@ -138,8 +135,8 @@ fn asin64(x: f64) -> f64 { |
| 138 | } | 135 | } |
| 139 | 136 | ||
| 140 | test "math.asin" { | 137 | test "math.asin" { |
| 141 | assert(asin_workaround(f32(0.0)) == asin32(0.0)); | 138 | assert(asin(f32(0.0)) == asin32(0.0)); |
| 142 | assert(asin_workaround(f64(0.0)) == asin64(0.0)); | 139 | assert(asin(f64(0.0)) == asin64(0.0)); |
| 143 | } | 140 | } |
| 144 | 141 | ||
| 145 | test "math.asin32" { | 142 | test "math.asin32" { |
std/math/asinh.zig+3-6| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | pub const asinh = asinh_workaround; | 10 | pub fn asinh(x: var) -> @typeOf(x) { |
| 11 | |||
| 12 | // TODO issue #393 | ||
| 13 | pub fn asinh_workaround(x: var) -> @typeOf(x) { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(asinh32, x), | 13 | f32 => @inlineCall(asinh32, x), |
| ... | @@ -84,8 +81,8 @@ fn asinh64(x: f64) -> f64 { | ... | @@ -84,8 +81,8 @@ fn asinh64(x: f64) -> f64 { |
| 84 | } | 81 | } |
| 85 | 82 | ||
| 86 | test "math.asinh" { | 83 | test "math.asinh" { |
| 87 | assert(asinh_workaround(f32(0.0)) == asinh32(0.0)); | 84 | assert(asinh(f32(0.0)) == asinh32(0.0)); |
| 88 | assert(asinh_workaround(f64(0.0)) == asinh64(0.0)); | 85 | assert(asinh(f64(0.0)) == asinh64(0.0)); |
| 89 | } | 86 | } |
| 90 | 87 | ||
| 91 | test "math.asinh32" { | 88 | test "math.asinh32" { |
std/math/atan.zig+3-6| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | 9 | pub fn atan(x: var) -> @typeOf(x) { |
| 10 | pub const atan = atan_workaround; | ||
| 11 | |||
| 12 | pub fn atan_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(atan32, x), | 12 | f32 => @inlineCall(atan32, x), |
| ... | @@ -210,8 +207,8 @@ fn atan64(x_: f64) -> f64 { | ... | @@ -210,8 +207,8 @@ fn atan64(x_: f64) -> f64 { |
| 210 | } | 207 | } |
| 211 | 208 | ||
| 212 | test "math.atan" { | 209 | test "math.atan" { |
| 213 | assert(atan_workaround(f32(0.2)) == atan32(0.2)); | 210 | assert(atan(f32(0.2)) == atan32(0.2)); |
| 214 | assert(atan_workaround(f64(0.2)) == atan64(0.2)); | 211 | assert(atan(f64(0.2)) == atan64(0.2)); |
| 215 | } | 212 | } |
| 216 | 213 | ||
| 217 | test "math.atan32" { | 214 | test "math.atan32" { |
std/math/atan2.zig+3-6| ... | @@ -21,10 +21,7 @@ | ... | @@ -21,10 +21,7 @@ |
| 21 | const math = @import("index.zig"); | 21 | const math = @import("index.zig"); |
| 22 | const assert = @import("../debug.zig").assert; | 22 | const assert = @import("../debug.zig").assert; |
| 23 | 23 | ||
| 24 | pub const atan2 = atan2_workaround; | 24 | fn atan2(comptime T: type, x: T, y: T) -> T { |
| 25 | |||
| 26 | // TODO issue #393 | ||
| 27 | fn atan2_workaround(comptime T: type, x: T, y: T) -> T { | ||
| 28 | switch (T) { | 25 | switch (T) { |
| 29 | f32 => @inlineCall(atan2_32, x, y), | 26 | f32 => @inlineCall(atan2_32, x, y), |
| 30 | f64 => @inlineCall(atan2_64, x, y), | 27 | f64 => @inlineCall(atan2_64, x, y), |
| ... | @@ -208,8 +205,8 @@ fn atan2_64(y: f64, x: f64) -> f64 { | ... | @@ -208,8 +205,8 @@ fn atan2_64(y: f64, x: f64) -> f64 { |
| 208 | } | 205 | } |
| 209 | 206 | ||
| 210 | test "math.atan2" { | 207 | test "math.atan2" { |
| 211 | assert(atan2_workaround(f32, 0.2, 0.21) == atan2_32(0.2, 0.21)); | 208 | assert(atan2(f32, 0.2, 0.21) == atan2_32(0.2, 0.21)); |
| 212 | assert(atan2_workaround(f64, 0.2, 0.21) == atan2_64(0.2, 0.21)); | 209 | assert(atan2(f64, 0.2, 0.21) == atan2_64(0.2, 0.21)); |
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | test "math.atan2_32" { | 212 | test "math.atan2_32" { |
std/math/atanh.zig+1-4| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | 10 | pub fn atanh(x: var) -> @typeOf(x) { |
| 11 | pub const atanh = atanh_workaround; | ||
| 12 | |||
| 13 | pub fn atanh_workaround(x: var) -> @typeOf(x) { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(atanh_32, x), | 13 | f32 => @inlineCall(atanh_32, x), |
std/math/cbrt.zig+1-4| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | 10 | pub fn cbrt(x: var) -> @typeOf(x) { |
| 11 | pub const cbrt = cbrt_workaround; | ||
| 12 | |||
| 13 | pub fn cbrt_workaround(x: var) -> @typeOf(x) { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(cbrt32, x), | 13 | f32 => @inlineCall(cbrt32, x), |
std/math/ceil.zig+1-4| ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); | ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); |
| 8 | const math = @import("index.zig"); | 8 | const math = @import("index.zig"); |
| 9 | const assert = @import("../debug.zig").assert; | 9 | const assert = @import("../debug.zig").assert; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn ceil(x: var) -> @typeOf(x) { |
| 12 | pub const ceil = ceil_workaround; | ||
| 13 | |||
| 14 | pub fn ceil_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(ceil32, x), | 14 | f32 => @inlineCall(ceil32, x), |
std/math/copysign.zig+1-4| ... | @@ -1,10 +1,7 @@ | ... | @@ -1,10 +1,7 @@ |
| 1 | const math = @import("index.zig"); | 1 | const math = @import("index.zig"); |
| 2 | const assert = @import("../debug.zig").assert; | 2 | const assert = @import("../debug.zig").assert; |
| 3 | 3 | ||
| 4 | // TODO issue #393 | 4 | pub fn copysign(comptime T: type, x: T, y: T) -> T { |
| 5 | pub const copysign = copysign_workaround; | ||
| 6 | |||
| 7 | pub fn copysign_workaround(comptime T: type, x: T, y: T) -> T { | ||
| 8 | switch (T) { | 5 | switch (T) { |
| 9 | f32 => @inlineCall(copysign32, x, y), | 6 | f32 => @inlineCall(copysign32, x, y), |
| 10 | f64 => @inlineCall(copysign64, x, y), | 7 | f64 => @inlineCall(copysign64, x, y), |
std/math/cos.zig+1-4| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | 9 | pub fn cos(x: var) -> @typeOf(x) { |
| 10 | pub const cos = cos_workaround; | ||
| 11 | |||
| 12 | pub fn cos_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(cos32, x), | 12 | f32 => @inlineCall(cos32, x), |
std/math/cosh.zig+1-4| ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); | ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); |
| 8 | const expo2 = @import("expo2.zig").expo2; | 8 | const expo2 = @import("expo2.zig").expo2; |
| 9 | const assert = @import("../debug.zig").assert; | 9 | const assert = @import("../debug.zig").assert; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn cosh(x: var) -> @typeOf(x) { |
| 12 | pub const cosh = cosh_workaround; | ||
| 13 | |||
| 14 | pub fn cosh_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(cosh32, x), | 14 | f32 => @inlineCall(cosh32, x), |
std/math/exp.zig+1-4| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | 9 | pub fn exp(x: var) -> @typeOf(x) { |
| 10 | pub const exp = exp_workaround; | ||
| 11 | |||
| 12 | pub fn exp_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(exp32, x), | 12 | f32 => @inlineCall(exp32, x), |
std/math/exp2.zig+1-4| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | 9 | pub fn exp2(x: var) -> @typeOf(x) { |
| 10 | pub const exp2 = exp2_workaround; | ||
| 11 | |||
| 12 | pub fn exp2_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(exp2_32, x), | 12 | f32 => @inlineCall(exp2_32, x), |
std/math/expm1.zig+1-4| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | 10 | pub fn expm1(x: var) -> @typeOf(x) { |
| 11 | pub const expm1 = expm1_workaround; | ||
| 12 | |||
| 13 | pub fn expm1_workaround(x: var) -> @typeOf(x) { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(expm1_32, x), | 13 | f32 => @inlineCall(expm1_32, x), |
std/math/fabs.zig+1-4| ... | @@ -6,10 +6,7 @@ | ... | @@ -6,10 +6,7 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | 9 | pub fn fabs(x: var) -> @typeOf(x) { |
| 10 | pub const fabs = fabs_workaround; | ||
| 11 | |||
| 12 | pub fn fabs_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 10 | const T = @typeOf(x); |
| 14 | switch (T) { | 11 | switch (T) { |
| 15 | f32 => @inlineCall(fabs32, x), | 12 | f32 => @inlineCall(fabs32, x), |
std/math/floor.zig+1-4| ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); | ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | const math = @import("index.zig"); | 9 | const math = @import("index.zig"); |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn floor(x: var) -> @typeOf(x) { |
| 12 | pub const floor = floor_workaround; | ||
| 13 | |||
| 14 | pub fn floor_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(floor32, x), | 14 | f32 => @inlineCall(floor32, x), |
std/math/fma.zig+1-4| ... | @@ -1,10 +1,7 @@ | ... | @@ -1,10 +1,7 @@ |
| 1 | const math = @import("index.zig"); | 1 | const math = @import("index.zig"); |
| 2 | const assert = @import("../debug.zig").assert; | 2 | const assert = @import("../debug.zig").assert; |
| 3 | 3 | ||
| 4 | // TODO issue #393 | 4 | pub fn fma(comptime T: type, x: T, y: T, z: T) -> T { |
| 5 | pub const fma = fma_workaround; | ||
| 6 | |||
| 7 | pub fn fma_workaround(comptime T: type, x: T, y: T, z: T) -> T { | ||
| 8 | switch (T) { | 5 | switch (T) { |
| 9 | f32 => @inlineCall(fma32, x, y, z), | 6 | f32 => @inlineCall(fma32, x, y, z), |
| 10 | f64 => @inlineCall(fma64, x, y ,z), | 7 | f64 => @inlineCall(fma64, x, y ,z), |
std/math/frexp.zig+1-4| ... | @@ -7,9 +7,6 @@ | ... | @@ -7,9 +7,6 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | ||
| 11 | pub const frexp = frexp_workaround; | ||
| 12 | |||
| 13 | fn frexp_result(comptime T: type) -> type { | 10 | fn frexp_result(comptime T: type) -> type { |
| 14 | struct { | 11 | struct { |
| 15 | significand: T, | 12 | significand: T, |
| ... | @@ -19,7 +16,7 @@ fn frexp_result(comptime T: type) -> type { | ... | @@ -19,7 +16,7 @@ fn frexp_result(comptime T: type) -> type { |
| 19 | pub const frexp32_result = frexp_result(f32); | 16 | pub const frexp32_result = frexp_result(f32); |
| 20 | pub const frexp64_result = frexp_result(f64); | 17 | pub const frexp64_result = frexp_result(f64); |
| 21 | 18 | ||
| 22 | pub fn frexp_workaround(x: var) -> frexp_result(@typeOf(x)) { | 19 | pub fn frexp(x: var) -> frexp_result(@typeOf(x)) { |
| 23 | const T = @typeOf(x); | 20 | const T = @typeOf(x); |
| 24 | switch (T) { | 21 | switch (T) { |
| 25 | f32 => @inlineCall(frexp32, x), | 22 | f32 => @inlineCall(frexp32, x), |
std/math/hypot.zig+1-4| ... | @@ -8,10 +8,7 @@ | ... | @@ -8,10 +8,7 @@ |
| 8 | const math = @import("index.zig"); | 8 | const math = @import("index.zig"); |
| 9 | const assert = @import("../debug.zig").assert; | 9 | const assert = @import("../debug.zig").assert; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn hypot(comptime T: type, x: T, y: T) -> T { |
| 12 | pub const hypot = hypot_workaround; | ||
| 13 | |||
| 14 | pub fn hypot_workaround(comptime T: type, x: T, y: T) -> T { | ||
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(hypot32, x, y), | 13 | f32 => @inlineCall(hypot32, x, y), |
| 17 | f64 => @inlineCall(hypot64, x, y), | 14 | f64 => @inlineCall(hypot64, x, y), |
std/math/ilogb.zig+1-4| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | 10 | pub fn ilogb(x: var) -> i32 { |
| 11 | pub const ilogb = ilogb_workaround; | ||
| 12 | |||
| 13 | pub fn ilogb_workaround(x: var) -> i32 { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(ilogb32, x), | 13 | f32 => @inlineCall(ilogb32, x), |
std/math/ln.zig+1-3| ... | @@ -10,9 +10,7 @@ const assert = @import("../debug.zig").assert; | ... | @@ -10,9 +10,7 @@ const assert = @import("../debug.zig").assert; |
| 10 | const builtin = @import("builtin"); | 10 | const builtin = @import("builtin"); |
| 11 | const TypeId = builtin.TypeId; | 11 | const TypeId = builtin.TypeId; |
| 12 | 12 | ||
| 13 | pub const ln = ln_workaround; | 13 | pub fn ln(x: var) -> @typeOf(x) { |
| 14 | |||
| 15 | fn ln_workaround(x: var) -> @typeOf(x) { | ||
| 16 | const T = @typeOf(x); | 14 | const T = @typeOf(x); |
| 17 | switch (@typeId(T)) { | 15 | switch (@typeId(T)) { |
| 18 | TypeId.FloatLiteral => { | 16 | TypeId.FloatLiteral => { |
std/math/log.zig+1-4| ... | @@ -3,10 +3,7 @@ const builtin = @import("builtin"); | ... | @@ -3,10 +3,7 @@ const builtin = @import("builtin"); |
| 3 | const TypeId = builtin.TypeId; | 3 | const TypeId = builtin.TypeId; |
| 4 | const assert = @import("../debug.zig").assert; | 4 | const assert = @import("../debug.zig").assert; |
| 5 | 5 | ||
| 6 | // TODO issue #393 | 6 | pub fn log(comptime T: type, base: T, x: T) -> T { |
| 7 | pub const log = log_workaround; | ||
| 8 | |||
| 9 | fn log_workaround(comptime T: type, base: T, x: T) -> T { | ||
| 10 | if (base == 2) { | 7 | if (base == 2) { |
| 11 | return math.log2(x); | 8 | return math.log2(x); |
| 12 | } else if (base == 10) { | 9 | } else if (base == 10) { |
std/math/log10.zig+1-4| ... | @@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert; | ... | @@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert; |
| 10 | const builtin = @import("builtin"); | 10 | const builtin = @import("builtin"); |
| 11 | const TypeId = builtin.TypeId; | 11 | const TypeId = builtin.TypeId; |
| 12 | 12 | ||
| 13 | // TODO issue #393 | 13 | pub fn log10(x: var) -> @typeOf(x) { |
| 14 | pub const log10 = log10_workaround; | ||
| 15 | |||
| 16 | fn log10_workaround(x: var) -> @typeOf(x) { | ||
| 17 | const T = @typeOf(x); | 14 | const T = @typeOf(x); |
| 18 | switch (@typeId(T)) { | 15 | switch (@typeId(T)) { |
| 19 | TypeId.FloatLiteral => { | 16 | TypeId.FloatLiteral => { |
std/math/log1p.zig+1-4| ... | @@ -9,10 +9,7 @@ | ... | @@ -9,10 +9,7 @@ |
| 9 | const math = @import("index.zig"); | 9 | const math = @import("index.zig"); |
| 10 | const assert = @import("../debug.zig").assert; | 10 | const assert = @import("../debug.zig").assert; |
| 11 | 11 | ||
| 12 | // TODO issue #393 | 12 | pub fn log1p(x: var) -> @typeOf(x) { |
| 13 | pub const log1p = log1p_workaround; | ||
| 14 | |||
| 15 | pub fn log1p_workaround(x: var) -> @typeOf(x) { | ||
| 16 | const T = @typeOf(x); | 13 | const T = @typeOf(x); |
| 17 | switch (T) { | 14 | switch (T) { |
| 18 | f32 => @inlineCall(log1p_32, x), | 15 | f32 => @inlineCall(log1p_32, x), |
std/math/log2.zig+1-4| ... | @@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert; | ... | @@ -10,10 +10,7 @@ const assert = @import("../debug.zig").assert; |
| 10 | const builtin = @import("builtin"); | 10 | const builtin = @import("builtin"); |
| 11 | const TypeId = builtin.TypeId; | 11 | const TypeId = builtin.TypeId; |
| 12 | 12 | ||
| 13 | // TODO issue #393 | 13 | pub fn log2(x: var) -> @typeOf(x) { |
| 14 | pub const log2 = log2_workaround; | ||
| 15 | |||
| 16 | fn log2_workaround(x: var) -> @typeOf(x) { | ||
| 17 | const T = @typeOf(x); | 14 | const T = @typeOf(x); |
| 18 | switch (@typeId(T)) { | 15 | switch (@typeId(T)) { |
| 19 | TypeId.FloatLiteral => { | 16 | TypeId.FloatLiteral => { |
std/math/modf.zig+1-4| ... | @@ -6,9 +6,6 @@ | ... | @@ -6,9 +6,6 @@ |
| 6 | const math = @import("index.zig"); | 6 | const math = @import("index.zig"); |
| 7 | const assert = @import("../debug.zig").assert; | 7 | const assert = @import("../debug.zig").assert; |
| 8 | 8 | ||
| 9 | // TODO issue #393 | ||
| 10 | pub const modf = modf_workaround; | ||
| 11 | |||
| 12 | fn modf_result(comptime T: type) -> type { | 9 | fn modf_result(comptime T: type) -> type { |
| 13 | struct { | 10 | struct { |
| 14 | fpart: T, | 11 | fpart: T, |
| ... | @@ -18,7 +15,7 @@ fn modf_result(comptime T: type) -> type { | ... | @@ -18,7 +15,7 @@ fn modf_result(comptime T: type) -> type { |
| 18 | pub const modf32_result = modf_result(f32); | 15 | pub const modf32_result = modf_result(f32); |
| 19 | pub const modf64_result = modf_result(f64); | 16 | pub const modf64_result = modf_result(f64); |
| 20 | 17 | ||
| 21 | pub fn modf_workaround(x: var) -> modf_result(@typeOf(x)) { | 18 | pub fn modf(x: var) -> modf_result(@typeOf(x)) { |
| 22 | const T = @typeOf(x); | 19 | const T = @typeOf(x); |
| 23 | switch (T) { | 20 | switch (T) { |
| 24 | f32 => @inlineCall(modf32, x), | 21 | f32 => @inlineCall(modf32, x), |
std/math/nan.zig+2-6| ... | @@ -1,8 +1,6 @@ | ... | @@ -1,8 +1,6 @@ |
| 1 | const math = @import("index.zig"); | 1 | const math = @import("index.zig"); |
| 2 | 2 | ||
| 3 | pub const nan = nan_workaround; | 3 | pub fn nan(comptime T: type) -> T { |
| 4 | |||
| 5 | pub fn nan_workaround(comptime T: type) -> T { | ||
| 6 | switch (T) { | 4 | switch (T) { |
| 7 | f32 => @bitCast(f32, math.nan_u32), | 5 | f32 => @bitCast(f32, math.nan_u32), |
| 8 | f64 => @bitCast(f64, math.nan_u64), | 6 | f64 => @bitCast(f64, math.nan_u64), |
| ... | @@ -10,11 +8,9 @@ pub fn nan_workaround(comptime T: type) -> T { | ... | @@ -10,11 +8,9 @@ pub fn nan_workaround(comptime T: type) -> T { |
| 10 | } | 8 | } |
| 11 | } | 9 | } |
| 12 | 10 | ||
| 13 | pub const snan = snan_workaround; | ||
| 14 | |||
| 15 | // Note: A signalling nan is identical to a standard right now by may have a different bit | 11 | // Note: A signalling nan is identical to a standard right now by may have a different bit |
| 16 | // representation in the future when required. | 12 | // representation in the future when required. |
| 17 | pub fn snan_workaround(comptime T: type) -> T { | 13 | pub fn snan(comptime T: type) -> T { |
| 18 | switch (T) { | 14 | switch (T) { |
| 19 | f32 => @bitCast(f32, math.nan_u32), | 15 | f32 => @bitCast(f32, math.nan_u32), |
| 20 | f64 => @bitCast(f64, math.nan_u64), | 16 | f64 => @bitCast(f64, math.nan_u64), |
std/math/pow.zig+1-4| ... | @@ -24,11 +24,8 @@ | ... | @@ -24,11 +24,8 @@ |
| 24 | const math = @import("index.zig"); | 24 | const math = @import("index.zig"); |
| 25 | const assert = @import("../debug.zig").assert; | 25 | const assert = @import("../debug.zig").assert; |
| 26 | 26 | ||
| 27 | // TODO issue #393 | ||
| 28 | pub const pow = pow_workaround; | ||
| 29 | |||
| 30 | // This implementation is taken from the go stlib, musl is a bit more complex. | 27 | // This implementation is taken from the go stlib, musl is a bit more complex. |
| 31 | pub fn pow_workaround(comptime T: type, x: T, y: T) -> T { | 28 | pub fn pow(comptime T: type, x: T, y: T) -> T { |
| 32 | 29 | ||
| 33 | @setFloatMode(this, @import("builtin").FloatMode.Strict); | 30 | @setFloatMode(this, @import("builtin").FloatMode.Strict); |
| 34 | 31 |
std/math/round.zig+1-4| ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); | ... | @@ -8,10 +8,7 @@ const builtin = @import("builtin"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | const math = @import("index.zig"); | 9 | const math = @import("index.zig"); |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn round(x: var) -> @typeOf(x) { |
| 12 | pub const round = round_workaround; | ||
| 13 | |||
| 14 | pub fn round_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(round32, x), | 14 | f32 => @inlineCall(round32, x), |
std/math/scalbn.zig+1-4| ... | @@ -1,10 +1,7 @@ | ... | @@ -1,10 +1,7 @@ |
| 1 | const math = @import("index.zig"); | 1 | const math = @import("index.zig"); |
| 2 | const assert = @import("../debug.zig").assert; | 2 | const assert = @import("../debug.zig").assert; |
| 3 | 3 | ||
| 4 | // TODO issue #393 | 4 | pub fn scalbn(x: var, n: i32) -> @typeOf(x) { |
| 5 | pub const scalbn = scalbn_workaround; | ||
| 6 | |||
| 7 | pub fn scalbn_workaround(x: var, n: i32) -> @typeOf(x) { | ||
| 8 | const T = @typeOf(x); | 5 | const T = @typeOf(x); |
| 9 | switch (T) { | 6 | switch (T) { |
| 10 | f32 => @inlineCall(scalbn32, x, n), | 7 | f32 => @inlineCall(scalbn32, x, n), |
std/math/signbit.zig+1-4| ... | @@ -1,10 +1,7 @@ | ... | @@ -1,10 +1,7 @@ |
| 1 | const math = @import("index.zig"); | 1 | const math = @import("index.zig"); |
| 2 | const assert = @import("../debug.zig").assert; | 2 | const assert = @import("../debug.zig").assert; |
| 3 | 3 | ||
| 4 | // TODO issue #393 | 4 | pub fn signbit(x: var) -> bool { |
| 5 | pub const signbit = signbit_workaround; | ||
| 6 | |||
| 7 | pub fn signbit_workaround(x: var) -> bool { | ||
| 8 | const T = @typeOf(x); | 5 | const T = @typeOf(x); |
| 9 | switch (T) { | 6 | switch (T) { |
| 10 | f32 => @inlineCall(signbit32, x), | 7 | f32 => @inlineCall(signbit32, x), |
std/math/sin.zig+1-4| ... | @@ -7,10 +7,7 @@ | ... | @@ -7,10 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | // TODO issue #393 | 10 | pub fn sin(x: var) -> @typeOf(x) { |
| 11 | pub const sin = sin_workaround; | ||
| 12 | |||
| 13 | pub fn sin_workaround(x: var) -> @typeOf(x) { | ||
| 14 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 15 | switch (T) { | 12 | switch (T) { |
| 16 | f32 => @inlineCall(sin32, x), | 13 | f32 => @inlineCall(sin32, x), |
std/math/sinh.zig+1-4| ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); | ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | const expo2 = @import("expo2.zig").expo2; | 9 | const expo2 = @import("expo2.zig").expo2; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn sinh(x: var) -> @typeOf(x) { |
| 12 | pub const sinh = sinh_workaround; | ||
| 13 | |||
| 14 | pub fn sinh_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(sinh32, x), | 14 | f32 => @inlineCall(sinh32, x), |
std/math/sqrt.zig+1-4| ... | @@ -8,10 +8,7 @@ | ... | @@ -8,10 +8,7 @@ |
| 8 | const math = @import("index.zig"); | 8 | const math = @import("index.zig"); |
| 9 | const assert = @import("../debug.zig").assert; | 9 | const assert = @import("../debug.zig").assert; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn sqrt(x: var) -> @typeOf(x) { |
| 12 | pub const sqrt = sqrt_workaround; | ||
| 13 | |||
| 14 | pub fn sqrt_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(sqrt32, x), | 14 | f32 => @inlineCall(sqrt32, x), |
std/math/tan.zig+1-3| ... | @@ -7,9 +7,7 @@ | ... | @@ -7,9 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | pub const tan = tan_workaround; | 10 | pub fn tan(x: var) -> @typeOf(x) { |
| 11 | |||
| 12 | pub fn tan_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 14 | switch (T) { | 12 | switch (T) { |
| 15 | f32 => @inlineCall(tan32, x), | 13 | f32 => @inlineCall(tan32, x), |
std/math/tanh.zig+1-4| ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); | ... | @@ -8,10 +8,7 @@ const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | const expo2 = @import("expo2.zig").expo2; | 9 | const expo2 = @import("expo2.zig").expo2; |
| 10 | 10 | ||
| 11 | // TODO issue #393 | 11 | pub fn tanh(x: var) -> @typeOf(x) { |
| 12 | pub const tanh = tanh_workaround; | ||
| 13 | |||
| 14 | pub fn tanh_workaround(x: var) -> @typeOf(x) { | ||
| 15 | const T = @typeOf(x); | 12 | const T = @typeOf(x); |
| 16 | switch (T) { | 13 | switch (T) { |
| 17 | f32 => @inlineCall(tanh32, x), | 14 | f32 => @inlineCall(tanh32, x), |
std/math/trunc.zig+1-3| ... | @@ -7,9 +7,7 @@ | ... | @@ -7,9 +7,7 @@ |
| 7 | const math = @import("index.zig"); | 7 | const math = @import("index.zig"); |
| 8 | const assert = @import("../debug.zig").assert; | 8 | const assert = @import("../debug.zig").assert; |
| 9 | 9 | ||
| 10 | pub const trunc = trunc_workaround; | 10 | pub fn trunc(x: var) -> @typeOf(x) { |
| 11 | |||
| 12 | pub fn trunc_workaround(x: var) -> @typeOf(x) { | ||
| 13 | const T = @typeOf(x); | 11 | const T = @typeOf(x); |
| 14 | switch (T) { | 12 | switch (T) { |
| 15 | f32 => @inlineCall(trunc32, x), | 13 | f32 => @inlineCall(trunc32, x), |