Commit e44a11341d
Changed files (31)
std/math/acos.zig
@@ -8,8 +8,8 @@ const assert = @import("../debug.zig").assert;
pub fn acos(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(acos32, x),
- f64 => @inlineCall(acos64, x),
+ f32 => acos32(x),
+ f64 => acos64(x),
else => @compileError("acos not implemented for " ++ @typeName(T)),
};
}
std/math/acosh.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn acosh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(acosh32, x),
- f64 => @inlineCall(acosh64, x),
+ f32 => acosh32(x),
+ f64 => acosh64(x),
else => @compileError("acosh not implemented for " ++ @typeName(T)),
};
}
std/math/asin.zig
@@ -9,8 +9,8 @@ const assert = @import("../debug.zig").assert;
pub fn asin(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(asin32, x),
- f64 => @inlineCall(asin64, x),
+ f32 => asin32(x),
+ f64 => asin64(x),
else => @compileError("asin not implemented for " ++ @typeName(T)),
};
}
std/math/asinh.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn asinh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(asinh32, x),
- f64 => @inlineCall(asinh64, x),
+ f32 => asinh32(x),
+ f64 => asinh64(x),
else => @compileError("asinh not implemented for " ++ @typeName(T)),
};
}
std/math/atan.zig
@@ -9,8 +9,8 @@ const assert = @import("../debug.zig").assert;
pub fn atan(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(atan32, x),
- f64 => @inlineCall(atan64, x),
+ f32 => atan32(x),
+ f64 => atan64(x),
else => @compileError("atan not implemented for " ++ @typeName(T)),
};
}
@@ -99,11 +99,11 @@ fn atan32(x_: f32) -> f32 {
const s1 = z * (aT[0] + w * (aT[2] + w * aT[4]));
const s2 = w * (aT[1] + w * aT[3]);
- if (id == null) {
- return x - x * (s1 + s2);
- } else {
- const zz = atanhi[??id] - ((x * (s1 + s2) - atanlo[??id]) - x);
+ if (id) |id_value| {
+ const zz = atanhi[id_value] - ((x * (s1 + s2) - atanlo[id_value]) - x);
return if (sign != 0) -zz else zz;
+ } else {
+ return x - x * (s1 + s2);
}
}
@@ -198,16 +198,16 @@ fn atan64(x_: f64) -> f64 {
const s1 = z * (aT[0] + w * (aT[2] + w * (aT[4] + w * (aT[6] + w * (aT[8] + w * aT[10])))));
const s2 = w * (aT[1] + w * (aT[3] + w * (aT[5] + w * (aT[7] + w * aT[9]))));
- if (id == null) {
- return x - x * (s1 + s2);
- } else {
- const zz = atanhi[??id] - ((x * (s1 + s2) - atanlo[??id]) - x);
+ if (id) |id_value| {
+ const zz = atanhi[id_value] - ((x * (s1 + s2) - atanlo[id_value]) - x);
return if (sign != 0) -zz else zz;
+ } else {
+ return x - x * (s1 + s2);
}
}
test "math.atan" {
- assert(atan(f32(0.2)) == atan32(0.2));
+ assert(@bitCast(u32, atan(f32(0.2))) == @bitCast(u32, atan32(0.2)));
assert(atan(f64(0.2)) == atan64(0.2));
}
std/math/atan2.zig
@@ -23,8 +23,8 @@ const assert = @import("../debug.zig").assert;
fn atan2(comptime T: type, x: T, y: T) -> T {
return switch (T) {
- f32 => @inlineCall(atan2_32, x, y),
- f64 => @inlineCall(atan2_64, x, y),
+ f32 => atan2_32(x, y),
+ f64 => atan2_64(x, y),
else => @compileError("atan2 not implemented for " ++ @typeName(T)),
};
}
std/math/atanh.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn atanh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(atanh_32, x),
- f64 => @inlineCall(atanh_64, x),
+ f32 => atanh_32(x),
+ f64 => atanh_64(x),
else => @compileError("atanh not implemented for " ++ @typeName(T)),
};
}
std/math/cbrt.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn cbrt(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(cbrt32, x),
- f64 => @inlineCall(cbrt64, x),
+ f32 => cbrt32(x),
+ f64 => cbrt64(x),
else => @compileError("cbrt not implemented for " ++ @typeName(T)),
};
}
std/math/ceil.zig
@@ -11,8 +11,8 @@ const assert = @import("../debug.zig").assert;
pub fn ceil(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(ceil32, x),
- f64 => @inlineCall(ceil64, x),
+ f32 => ceil32(x),
+ f64 => ceil64(x),
else => @compileError("ceil not implemented for " ++ @typeName(T)),
};
}
std/math/copysign.zig
@@ -3,8 +3,8 @@ const assert = @import("../debug.zig").assert;
pub fn copysign(comptime T: type, x: T, y: T) -> T {
return switch (T) {
- f32 => @inlineCall(copysign32, x, y),
- f64 => @inlineCall(copysign64, x, y),
+ f32 => copysign32(x, y),
+ f64 => copysign64(x, y),
else => @compileError("copysign not implemented for " ++ @typeName(T)),
};
}
std/math/cos.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn cos(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(cos32, x),
- f64 => @inlineCall(cos64, x),
+ f32 => cos32(x),
+ f64 => cos64(x),
else => @compileError("cos not implemented for " ++ @typeName(T)),
};
}
std/math/cosh.zig
@@ -12,8 +12,8 @@ const assert = @import("../debug.zig").assert;
pub fn cosh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(cosh32, x),
- f64 => @inlineCall(cosh64, x),
+ f32 => cosh32(x),
+ f64 => cosh64(x),
else => @compileError("cosh not implemented for " ++ @typeName(T)),
};
}
std/math/exp.zig
@@ -9,8 +9,8 @@ const assert = @import("../debug.zig").assert;
pub fn exp(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(exp32, x),
- f64 => @inlineCall(exp64, x),
+ f32 => exp32(x),
+ f64 => exp64(x),
else => @compileError("exp not implemented for " ++ @typeName(T)),
};
}
std/math/exp2.zig
@@ -9,8 +9,8 @@ const assert = @import("../debug.zig").assert;
pub fn exp2(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(exp2_32, x),
- f64 => @inlineCall(exp2_64, x),
+ f32 => exp2_32(x),
+ f64 => exp2_64(x),
else => @compileError("exp2 not implemented for " ++ @typeName(T)),
};
}
std/math/expm1.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn expm1(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(expm1_32, x),
- f64 => @inlineCall(expm1_64, x),
+ f32 => expm1_32(x),
+ f64 => expm1_64(x),
else => @compileError("exp1m not implemented for " ++ @typeName(T)),
};
}
std/math/fabs.zig
@@ -9,8 +9,8 @@ const assert = @import("../debug.zig").assert;
pub fn fabs(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(fabs32, x),
- f64 => @inlineCall(fabs64, x),
+ f32 => fabs32(x),
+ f64 => fabs64(x),
else => @compileError("fabs not implemented for " ++ @typeName(T)),
};
}
std/math/floor.zig
@@ -11,8 +11,8 @@ const math = @import("index.zig");
pub fn floor(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(floor32, x),
- f64 => @inlineCall(floor64, x),
+ f32 => floor32(x),
+ f64 => floor64(x),
else => @compileError("floor not implemented for " ++ @typeName(T)),
};
}
std/math/fma.zig
@@ -3,8 +3,8 @@ const assert = @import("../debug.zig").assert;
pub fn fma(comptime T: type, x: T, y: T, z: T) -> T {
return switch (T) {
- f32 => @inlineCall(fma32, x, y, z),
- f64 => @inlineCall(fma64, x, y ,z),
+ f32 => fma32(x, y, z),
+ f64 => fma64(x, y ,z),
else => @compileError("fma not implemented for " ++ @typeName(T)),
};
}
std/math/frexp.zig
@@ -19,8 +19,8 @@ pub const frexp64_result = frexp_result(f64);
pub fn frexp(x: var) -> frexp_result(@typeOf(x)) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(frexp32, x),
- f64 => @inlineCall(frexp64, x),
+ f32 => frexp32(x),
+ f64 => frexp64(x),
else => @compileError("frexp not implemented for " ++ @typeName(T)),
};
}
std/math/hypot.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn hypot(comptime T: type, x: T, y: T) -> T {
return switch (T) {
- f32 => @inlineCall(hypot32, x, y),
- f64 => @inlineCall(hypot64, x, y),
+ f32 => hypot32(x, y),
+ f64 => hypot64(x, y),
else => @compileError("hypot not implemented for " ++ @typeName(T)),
};
}
std/math/ilogb.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn ilogb(x: var) -> i32 {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(ilogb32, x),
- f64 => @inlineCall(ilogb64, x),
+ f32 => ilogb32(x),
+ f64 => ilogb64(x),
else => @compileError("ilogb not implemented for " ++ @typeName(T)),
};
}
std/math/log1p.zig
@@ -12,8 +12,8 @@ const assert = @import("../debug.zig").assert;
pub fn log1p(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(log1p_32, x),
- f64 => @inlineCall(log1p_64, x),
+ f32 => log1p_32(x),
+ f64 => log1p_64(x),
else => @compileError("log1p not implemented for " ++ @typeName(T)),
};
}
std/math/modf.zig
@@ -18,8 +18,8 @@ pub const modf64_result = modf_result(f64);
pub fn modf(x: var) -> modf_result(@typeOf(x)) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(modf32, x),
- f64 => @inlineCall(modf64, x),
+ f32 => modf32(x),
+ f64 => modf64(x),
else => @compileError("modf not implemented for " ++ @typeName(T)),
};
}
std/math/round.zig
@@ -11,8 +11,8 @@ const math = @import("index.zig");
pub fn round(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(round32, x),
- f64 => @inlineCall(round64, x),
+ f32 => round32(x),
+ f64 => round64(x),
else => @compileError("round not implemented for " ++ @typeName(T)),
};
}
std/math/scalbn.zig
@@ -4,8 +4,8 @@ const assert = @import("../debug.zig").assert;
pub fn scalbn(x: var, n: i32) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(scalbn32, x, n),
- f64 => @inlineCall(scalbn64, x, n),
+ f32 => scalbn32(x, n),
+ f64 => scalbn64(x, n),
else => @compileError("scalbn not implemented for " ++ @typeName(T)),
};
}
std/math/signbit.zig
@@ -4,8 +4,8 @@ const assert = @import("../debug.zig").assert;
pub fn signbit(x: var) -> bool {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(signbit32, x),
- f64 => @inlineCall(signbit64, x),
+ f32 => signbit32(x),
+ f64 => signbit64(x),
else => @compileError("signbit not implemented for " ++ @typeName(T)),
};
}
std/math/sin.zig
@@ -11,8 +11,8 @@ const assert = @import("../debug.zig").assert;
pub fn sin(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(sin32, x),
- f64 => @inlineCall(sin64, x),
+ f32 => sin32(x),
+ f64 => sin64(x),
else => @compileError("sin not implemented for " ++ @typeName(T)),
};
}
std/math/sinh.zig
@@ -12,8 +12,8 @@ const expo2 = @import("expo2.zig").expo2;
pub fn sinh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(sinh32, x),
- f64 => @inlineCall(sinh64, x),
+ f32 => sinh32(x),
+ f64 => sinh64(x),
else => @compileError("sinh not implemented for " ++ @typeName(T)),
};
}
std/math/tan.zig
@@ -11,8 +11,8 @@ const assert = @import("../debug.zig").assert;
pub fn tan(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(tan32, x),
- f64 => @inlineCall(tan64, x),
+ f32 => tan32(x),
+ f64 => tan64(x),
else => @compileError("tan not implemented for " ++ @typeName(T)),
};
}
std/math/tanh.zig
@@ -12,8 +12,8 @@ const expo2 = @import("expo2.zig").expo2;
pub fn tanh(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(tanh32, x),
- f64 => @inlineCall(tanh64, x),
+ f32 => tanh32(x),
+ f64 => tanh64(x),
else => @compileError("tanh not implemented for " ++ @typeName(T)),
};
}
std/math/trunc.zig
@@ -10,8 +10,8 @@ const assert = @import("../debug.zig").assert;
pub fn trunc(x: var) -> @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
- f32 => @inlineCall(trunc32, x),
- f64 => @inlineCall(trunc64, x),
+ f32 => trunc32(x),
+ f64 => trunc64(x),
else => @compileError("trunc not implemented for " ++ @typeName(T)),
};
}