authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-28 04:28:42-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-28 04:28:42-04:00
logb8ed0cb3741533e036ee05faa165d2f0c49064f4
treeb49d168bb11b5fe40748a38cb758ddf6e68d7e04
parentd7a539906d2dd49872abb161f3d3364c9641ccd2

remove workaround for LLVM not respecting "nobuiltin"

now that we depend on LLVM 5.0.0 we can remove the workaround. closes #393

38 files changed, 51 insertions(+), 163 deletions(-)

std/math/acos.zig+3-6
...@@ -5,10 +5,7 @@...@@ -5,10 +5,7 @@
5const math = @import("index.zig");5const math = @import("index.zig");
6const assert = @import("../debug.zig").assert;6const assert = @import("../debug.zig").assert;
77
8pub const acos = acos_workaround;8pub fn acos(x: var) -> @typeOf(x) {
9
10// TODO issue #393
11pub 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}
146143
147test "math.acos" {144test "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}
151148
152test "math.acos32" {149test "math.acos32" {
std/math/acosh.zig+3-6
...@@ -6,10 +6,7 @@...@@ -6,10 +6,7 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9pub const acosh = acosh_workaround;9pub fn acosh(x: var) -> @typeOf(x) {
10
11// TODO issue #393
12pub 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}
5754
58test "math.acosh" {55test "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}
6259
63test "math.acosh32" {60test "math.acosh32" {
std/math/asin.zig+3-6
...@@ -6,10 +6,7 @@...@@ -6,10 +6,7 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9pub const asin = asin_workaround;9pub fn asin(x: var) -> @typeOf(x) {
10
11// TODO issue #393
12pub 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}
139136
140test "math.asin" {137test "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}
144141
145test "math.asin32" {142test "math.asin32" {
std/math/asinh.zig+3-6
...@@ -7,10 +7,7 @@...@@ -7,10 +7,7 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10pub const asinh = asinh_workaround;10pub fn asinh(x: var) -> @typeOf(x) {
11
12// TODO issue #393
13pub 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}
8582
86test "math.asinh" {83test "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}
9087
91test "math.asinh32" {88test "math.asinh32" {
std/math/atan.zig+3-6
...@@ -6,10 +6,7 @@...@@ -6,10 +6,7 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #3939pub fn atan(x: var) -> @typeOf(x) {
10pub const atan = atan_workaround;
11
12pub 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}
211208
212test "math.atan" {209test "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}
216213
217test "math.atan32" {214test "math.atan32" {
std/math/atan2.zig+3-6
...@@ -21,10 +21,7 @@...@@ -21,10 +21,7 @@
21const math = @import("index.zig");21const math = @import("index.zig");
22const assert = @import("../debug.zig").assert;22const assert = @import("../debug.zig").assert;
2323
24pub const atan2 = atan2_workaround;24fn atan2(comptime T: type, x: T, y: T) -> T {
25
26// TODO issue #393
27fn 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}
209206
210test "math.atan2" {207test "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}
214211
215test "math.atan2_32" {212test "math.atan2_32" {
std/math/atanh.zig+1-4
...@@ -7,10 +7,7 @@...@@ -7,10 +7,7 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #39310pub fn atanh(x: var) -> @typeOf(x) {
11pub const atanh = atanh_workaround;
12
13pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #39310pub fn cbrt(x: var) -> @typeOf(x) {
11pub const cbrt = cbrt_workaround;
12
13pub 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");
8const math = @import("index.zig");8const math = @import("index.zig");
9const assert = @import("../debug.zig").assert;9const assert = @import("../debug.zig").assert;
1010
11// TODO issue #39311pub fn ceil(x: var) -> @typeOf(x) {
12pub const ceil = ceil_workaround;
13
14pub 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 @@
1const math = @import("index.zig");1const math = @import("index.zig");
2const assert = @import("../debug.zig").assert;2const assert = @import("../debug.zig").assert;
33
4// TODO issue #3934pub fn copysign(comptime T: type, x: T, y: T) -> T {
5pub const copysign = copysign_workaround;
6
7pub 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 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #3939pub fn cos(x: var) -> @typeOf(x) {
10pub const cos = cos_workaround;
11
12pub 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");
8const expo2 = @import("expo2.zig").expo2;8const expo2 = @import("expo2.zig").expo2;
9const assert = @import("../debug.zig").assert;9const assert = @import("../debug.zig").assert;
1010
11// TODO issue #39311pub fn cosh(x: var) -> @typeOf(x) {
12pub const cosh = cosh_workaround;
13
14pub 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 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #3939pub fn exp(x: var) -> @typeOf(x) {
10pub const exp = exp_workaround;
11
12pub 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 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #3939pub fn exp2(x: var) -> @typeOf(x) {
10pub const exp2 = exp2_workaround;
11
12pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #39310pub fn expm1(x: var) -> @typeOf(x) {
11pub const expm1 = expm1_workaround;
12
13pub 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 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #3939pub fn fabs(x: var) -> @typeOf(x) {
10pub const fabs = fabs_workaround;
11
12pub 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");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
9const math = @import("index.zig");9const math = @import("index.zig");
1010
11// TODO issue #39311pub fn floor(x: var) -> @typeOf(x) {
12pub const floor = floor_workaround;
13
14pub 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 @@
1const math = @import("index.zig");1const math = @import("index.zig");
2const assert = @import("../debug.zig").assert;2const assert = @import("../debug.zig").assert;
33
4// TODO issue #3934pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
5pub const fma = fma_workaround;
6
7pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #393
11pub const frexp = frexp_workaround;
12
13fn frexp_result(comptime T: type) -> type {10fn 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 {
19pub const frexp32_result = frexp_result(f32);16pub const frexp32_result = frexp_result(f32);
20pub const frexp64_result = frexp_result(f64);17pub const frexp64_result = frexp_result(f64);
2118
22pub fn frexp_workaround(x: var) -> frexp_result(@typeOf(x)) {19pub 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 @@
8const math = @import("index.zig");8const math = @import("index.zig");
9const assert = @import("../debug.zig").assert;9const assert = @import("../debug.zig").assert;
1010
11// TODO issue #39311pub fn hypot(comptime T: type, x: T, y: T) -> T {
12pub const hypot = hypot_workaround;
13
14pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #39310pub fn ilogb(x: var) -> i32 {
11pub const ilogb = ilogb_workaround;
12
13pub 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;
10const builtin = @import("builtin");10const builtin = @import("builtin");
11const TypeId = builtin.TypeId;11const TypeId = builtin.TypeId;
1212
13pub const ln = ln_workaround;13pub fn ln(x: var) -> @typeOf(x) {
14
15fn 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");
3const TypeId = builtin.TypeId;3const TypeId = builtin.TypeId;
4const assert = @import("../debug.zig").assert;4const assert = @import("../debug.zig").assert;
55
6// TODO issue #3936pub fn log(comptime T: type, base: T, x: T) -> T {
7pub const log = log_workaround;
8
9fn 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;
10const builtin = @import("builtin");10const builtin = @import("builtin");
11const TypeId = builtin.TypeId;11const TypeId = builtin.TypeId;
1212
13// TODO issue #39313pub fn log10(x: var) -> @typeOf(x) {
14pub const log10 = log10_workaround;
15
16fn 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 @@
9const math = @import("index.zig");9const math = @import("index.zig");
10const assert = @import("../debug.zig").assert;10const assert = @import("../debug.zig").assert;
1111
12// TODO issue #39312pub fn log1p(x: var) -> @typeOf(x) {
13pub const log1p = log1p_workaround;
14
15pub 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;
10const builtin = @import("builtin");10const builtin = @import("builtin");
11const TypeId = builtin.TypeId;11const TypeId = builtin.TypeId;
1212
13// TODO issue #39313pub fn log2(x: var) -> @typeOf(x) {
14pub const log2 = log2_workaround;
15
16fn 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 @@
6const math = @import("index.zig");6const math = @import("index.zig");
7const assert = @import("../debug.zig").assert;7const assert = @import("../debug.zig").assert;
88
9// TODO issue #393
10pub const modf = modf_workaround;
11
12fn modf_result(comptime T: type) -> type {9fn 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 {
18pub const modf32_result = modf_result(f32);15pub const modf32_result = modf_result(f32);
19pub const modf64_result = modf_result(f64);16pub const modf64_result = modf_result(f64);
2017
21pub fn modf_workaround(x: var) -> modf_result(@typeOf(x)) {18pub 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 @@
1const math = @import("index.zig");1const math = @import("index.zig");
22
3pub const nan = nan_workaround;3pub fn nan(comptime T: type) -> T {
4
5pub 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}
1210
13pub const snan = snan_workaround;
14
15// Note: A signalling nan is identical to a standard right now by may have a different bit11// 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.
17pub fn snan_workaround(comptime T: type) -> T {13pub 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 @@
24const math = @import("index.zig");24const math = @import("index.zig");
25const assert = @import("../debug.zig").assert;25const assert = @import("../debug.zig").assert;
2626
27// TODO issue #393
28pub 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.
31pub fn pow_workaround(comptime T: type, x: T, y: T) -> T {28pub fn pow(comptime T: type, x: T, y: T) -> T {
3229
33 @setFloatMode(this, @import("builtin").FloatMode.Strict);30 @setFloatMode(this, @import("builtin").FloatMode.Strict);
3431
std/math/round.zig+1-4
...@@ -8,10 +8,7 @@ const builtin = @import("builtin");...@@ -8,10 +8,7 @@ const builtin = @import("builtin");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
9const math = @import("index.zig");9const math = @import("index.zig");
1010
11// TODO issue #39311pub fn round(x: var) -> @typeOf(x) {
12pub const round = round_workaround;
13
14pub 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 @@
1const math = @import("index.zig");1const math = @import("index.zig");
2const assert = @import("../debug.zig").assert;2const assert = @import("../debug.zig").assert;
33
4// TODO issue #3934pub fn scalbn(x: var, n: i32) -> @typeOf(x) {
5pub const scalbn = scalbn_workaround;
6
7pub 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 @@
1const math = @import("index.zig");1const math = @import("index.zig");
2const assert = @import("../debug.zig").assert;2const assert = @import("../debug.zig").assert;
33
4// TODO issue #3934pub fn signbit(x: var) -> bool {
5pub const signbit = signbit_workaround;
6
7pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10// TODO issue #39310pub fn sin(x: var) -> @typeOf(x) {
11pub const sin = sin_workaround;
12
13pub 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");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
9const expo2 = @import("expo2.zig").expo2;9const expo2 = @import("expo2.zig").expo2;
1010
11// TODO issue #39311pub fn sinh(x: var) -> @typeOf(x) {
12pub const sinh = sinh_workaround;
13
14pub 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 @@
8const math = @import("index.zig");8const math = @import("index.zig");
9const assert = @import("../debug.zig").assert;9const assert = @import("../debug.zig").assert;
1010
11// TODO issue #39311pub fn sqrt(x: var) -> @typeOf(x) {
12pub const sqrt = sqrt_workaround;
13
14pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10pub const tan = tan_workaround;10pub fn tan(x: var) -> @typeOf(x) {
11
12pub 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");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
9const expo2 = @import("expo2.zig").expo2;9const expo2 = @import("expo2.zig").expo2;
1010
11// TODO issue #39311pub fn tanh(x: var) -> @typeOf(x) {
12pub const tanh = tanh_workaround;
13
14pub 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 @@
7const math = @import("index.zig");7const math = @import("index.zig");
8const assert = @import("../debug.zig").assert;8const assert = @import("../debug.zig").assert;
99
10pub const trunc = trunc_workaround;10pub fn trunc(x: var) -> @typeOf(x) {
11
12pub 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),