authorgravatar for 77922942+expikr@users.noreply.github.comexpikr <77922942+expikr@users.noreply.github.com> 2023-11-08 04:10:43+08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-14 18:09:17-08:00
log0c70d9c71455122c6d67777c216e47133b8f8416
tree82d7f7dd7ccbbbbea2eb5891750e18f01ef060ec
parent9fce1d1ab19159cf86b22e805cdf3b73f7f10a57

use Peer Type Resolution for standalone complex fn

use peer type resolution Update complex.zig Revert "use peer type resolution" This reverts commit 1bc681ca5b36d2b55b5efab5a5dbec7e8a17332e. Revert "Update pow.zig" This reverts commit 5487e8d3159f832b5a0bf29a06bd12575182464f. Update pow.zig Revert "Update pow.zig" This reverts commit 521153d1ef004d627c785f2d3fe5e6497dc15073. Update pow.zig

18 files changed, 36 insertions(+), 36 deletions(-)

lib/std/math/complex/acos.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the arc-cosine of z.
8pub fn acos(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn acos(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const q = cmath.asin(z);
1111 return Complex(T).init(@as(T, math.pi) / 2 - q.re, -q.im);
1212}
lib/std/math/complex/acosh.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the hyperbolic arc-cosine of z.
8pub fn acosh(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn acosh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const q = cmath.acos(z);
1111 return Complex(T).init(-q.im, q.re);
1212}
lib/std/math/complex/asin.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77// Returns the arc-sine of z.
8pub fn asin(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn asin(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const x = z.re;
1111 const y = z.im;
1212
lib/std/math/complex/asinh.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the hyperbolic arc-sine of z.
8pub fn asinh(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn asinh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const q = Complex(T).init(-z.im, z.re);
1111 const r = cmath.asin(q);
1212 return Complex(T).init(r.im, -r.re);
lib/std/math/complex/atan.zig+2-2
......@@ -11,8 +11,8 @@ const cmath = math.complex;
1111const Complex = cmath.Complex;
1212
1313/// Returns the arc-tangent of z.
14pub fn atan(z: anytype) @TypeOf(z) {
15 const T = @TypeOf(z.re);
14pub fn atan(z: anytype) Complex(@TypeOf(z.re, z.im)) {
15 const T = @TypeOf(z.re, z.im);
1616 return switch (T) {
1717 f32 => atan32(z),
1818 f64 => atan64(z),
lib/std/math/complex/atanh.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the hyperbolic arc-tangent of z.
8pub fn atanh(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn atanh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const q = Complex(T).init(-z.im, z.re);
1111 const r = cmath.atan(q);
1212 return Complex(T).init(r.im, -r.re);
lib/std/math/complex/conj.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the complex conjugate of z.
8pub fn conj(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn conj(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 return Complex(T).init(z.re, -z.im);
1111}
1212
lib/std/math/complex/cos.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the cosine of z.
8pub fn cos(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn cos(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const p = Complex(T).init(-z.im, z.re);
1111 return cmath.cosh(p);
1212}
lib/std/math/complex/cosh.zig+2-2
......@@ -13,8 +13,8 @@ const Complex = cmath.Complex;
1313const ldexp_cexp = @import("ldexp.zig").ldexp_cexp;
1414
1515/// Returns the hyperbolic arc-cosine of z.
16pub fn cosh(z: anytype) Complex(@TypeOf(z.re)) {
17 const T = @TypeOf(z.re);
16pub fn cosh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
17 const T = @TypeOf(z.re, z.im);
1818 return switch (T) {
1919 f32 => cosh32(z),
2020 f64 => cosh64(z),
lib/std/math/complex/exp.zig+2-2
......@@ -13,8 +13,8 @@ const Complex = cmath.Complex;
1313const ldexp_cexp = @import("ldexp.zig").ldexp_cexp;
1414
1515/// Returns e raised to the power of z (e^z).
16pub fn exp(z: anytype) @TypeOf(z) {
17 const T = @TypeOf(z.re);
16pub fn exp(z: anytype) Complex(@TypeOf(z.re, z.im)) {
17 const T = @TypeOf(z.re, z.im);
1818
1919 return switch (T) {
2020 f32 => exp32(z),
lib/std/math/complex/ldexp.zig+2-2
......@@ -12,8 +12,8 @@ const cmath = math.complex;
1212const Complex = cmath.Complex;
1313
1414/// Returns exp(z) scaled to avoid overflow.
15pub fn ldexp_cexp(z: anytype, expt: i32) @TypeOf(z) {
16 const T = @TypeOf(z.re);
15pub fn ldexp_cexp(z: anytype, expt: i32) Complex(@TypeOf(z.re, z.im)) {
16 const T = @TypeOf(z.re, z.im);
1717
1818 return switch (T) {
1919 f32 => ldexp_cexp32(z, expt),
lib/std/math/complex/log.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the natural logarithm of z.
8pub fn log(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn log(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const r = cmath.abs(z);
1111 const phi = cmath.arg(z);
1212
lib/std/math/complex/proj.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the projection of z onto the riemann sphere.
8pub fn proj(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn proj(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010
1111 if (math.isInf(z.re) or math.isInf(z.im)) {
1212 return Complex(T).init(math.inf(T), math.copysign(@as(T, 0.0), z.re));
lib/std/math/complex/sin.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the sine of z.
8pub fn sin(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn sin(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const p = Complex(T).init(-z.im, z.re);
1111 const q = cmath.sinh(p);
1212 return Complex(T).init(q.im, -q.re);
lib/std/math/complex/sinh.zig+2-2
......@@ -13,8 +13,8 @@ const Complex = cmath.Complex;
1313const ldexp_cexp = @import("ldexp.zig").ldexp_cexp;
1414
1515/// Returns the hyperbolic sine of z.
16pub fn sinh(z: anytype) @TypeOf(z) {
17 const T = @TypeOf(z.re);
16pub fn sinh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
17 const T = @TypeOf(z.re, z.im);
1818 return switch (T) {
1919 f32 => sinh32(z),
2020 f64 => sinh64(z),
lib/std/math/complex/sqrt.zig+2-2
......@@ -12,8 +12,8 @@ const Complex = cmath.Complex;
1212
1313/// Returns the square root of z. The real and imaginary parts of the result have the same sign
1414/// as the imaginary part of z.
15pub fn sqrt(z: anytype) @TypeOf(z) {
16 const T = @TypeOf(z.re);
15pub fn sqrt(z: anytype) Complex(@TypeOf(z.re, z.im)) {
16 const T = @TypeOf(z.re, z.im);
1717
1818 return switch (T) {
1919 f32 => sqrt32(z),
lib/std/math/complex/tan.zig+2-2
......@@ -5,8 +5,8 @@ const cmath = math.complex;
55const Complex = cmath.Complex;
66
77/// Returns the tangent of z.
8pub fn tan(z: anytype) Complex(@TypeOf(z.re)) {
9 const T = @TypeOf(z.re);
8pub fn tan(z: anytype) Complex(@TypeOf(z.re, z.im)) {
9 const T = @TypeOf(z.re, z.im);
1010 const q = Complex(T).init(-z.im, z.re);
1111 const r = cmath.tanh(q);
1212 return Complex(T).init(r.im, -r.re);
lib/std/math/complex/tanh.zig+2-2
......@@ -11,8 +11,8 @@ const cmath = math.complex;
1111const Complex = cmath.Complex;
1212
1313/// Returns the hyperbolic tangent of z.
14pub fn tanh(z: anytype) @TypeOf(z) {
15 const T = @TypeOf(z.re);
14pub fn tanh(z: anytype) Complex(@TypeOf(z.re, z.im)) {
15 const T = @TypeOf(z.re, z.im);
1616 return switch (T) {
1717 f32 => tanh32(z),
1818 f64 => tanh64(z),