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