7[TypeForwardedFrom(
"System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
38 public Complex(
double real,
double imaginary)
101 return dividend / divisor;
106 return dividend / divisor;
111 return dividend / divisor;
151 double real = left.m_real * right.m_real - left.m_imaginary * right.
m_imaginary;
152 double imaginary = left.m_imaginary * right.m_real + left.m_real * right.
m_imaginary;
153 return new Complex(real, imaginary);
192 double real = left.
m_real;
194 double real2 = right.
m_real;
198 double num = imaginary2 / real2;
199 return new Complex((real + imaginary * num) / (real2 + imaginary2 * num), (imaginary - real * num) / (real2 + imaginary2 * num));
201 double num2 = real2 / imaginary2;
202 return new Complex((imaginary + real * num2) / (imaginary2 + real2 * num2), (0.0 - real + imaginary * num2) / (imaginary2 + real2 * num2));
228 double real = right.
m_real;
232 double num = imaginary / real;
233 return new Complex(left / (real + imaginary * num), (0.0 - left) * num / (real + imaginary * num));
235 double num2 = real / imaginary;
236 return new Complex(left * num2 / (imaginary + real * num2), (0.0 - left) / (imaginary + real * num2));
244 private static double Hypot(
double a,
double b)
264 if (
double.IsPositiveInfinity(num2) && !
double.
IsNaN(num))
266 return double.PositiveInfinity;
268 double num3 = num / num2;
269 return num2 *
Math.
Sqrt(1.0 + num3 * num3);
272 private static double Log1P(
double x)
274 double num = 1.0 + x;
281 return x *
Math.
Log(num) / (num - 1.0);
293 if (
value.m_real == 0.0 &&
value.m_imaginary == 0.0)
318 public override bool Equals([NotNullWhen(
true)]
object?
obj)
339 int num2 =
m_real.GetHashCode() % num;
341 return num2 ^ hashCode;
346 return $
"({m_real}, {m_imaginary})";
367 double num2 = 1.0 / num;
368 double num3 = (num - num2) * 0.5;
369 double num4 = (num + num2) * 0.5;
383 if (
value.Real < 0.0)
387 if (
value.Imaginary < 0.0)
397 double num2 = 1.0 / num;
398 double num3 = (num - num2) * 0.5;
399 double num4 = (num + num2) * 0.5;
412 if (
value.Real < 0.0)
416 if (
value.Imaginary > 0.0)
425 double num = 2.0 *
value.m_real;
426 double num2 = 2.0 *
value.m_imaginary;
428 double num4 = 1.0 / num3;
429 double num5 = (num3 + num4) * 0.5;
432 double num6 = (num3 - num4) * 0.5;
433 double num7 =
Math.
Cos(num) + num5;
436 double num8 = 1.0 +
Math.
Cos(num) / num5;
452 private static void Asin_Internal(
double x,
double y, out
double b, out
double bPrime, out
double v)
470 double num3 = num / num2;
474 double num4 =
Hypot(x + 1.0, y);
475 double num5 =
Hypot(x - 1.0, y);
476 double num6 = (num4 + num5) * 0.5;
482 double num7 = (y * y / (num4 + (x + 1.0)) + (num5 + (1.0 - x))) * 0.5;
483 bPrime = x /
Math.
Sqrt((num6 + x) * num7);
487 double num8 = (1.0 / (num4 + (x + 1.0)) + 1.0 / (num5 + (x - 1.0))) * 0.5;
488 bPrime = x / y /
Math.
Sqrt((num6 + x) * num8);
499 double num9 = (1.0 / (num4 + (x + 1.0)) + 1.0 / (num5 + (1.0 - x))) * 0.5;
500 double num10 = y * y * num9;
505 double num11 = (y * y / (num4 + (x + 1.0)) + (num5 + (x - 1.0))) * 0.5;
519 return double.IsFinite(
value.m_imaginary);
528 return double.IsInfinity(
value.m_imaginary);
555 return Scale(value2, 0.43429448190325);
563 return new Complex(real, imaginary);
568 if (
value.m_imaginary == 0.0)
570 if (
value.m_real < 0.0)
577 double num =
value.m_real;
578 double num2 =
value.m_imaginary;
583 return new Complex(
double.PositiveInfinity, num2);
594 num4 = num2 / (2.0 * num3);
603 num3 = num2 / (2.0 * num4);
610 return new Complex(num3, num4);
623 double real =
value.m_real;
624 double imaginary =
value.m_imaginary;
625 double real2 = power.
m_real;
628 double num2 =
Math.
Atan2(imaginary, real);
629 double num3 = real2 * num2 + imaginary2 *
Math.
Log(num);
641 double real = factor *
value.m_real;
642 double imaginary = factor *
value.m_imaginary;
643 return new Complex(real, imaginary);
661 [CLSCompliant(
false)]
667 [CLSCompliant(
false)]
673 [CLSCompliant(
false)]
679 [CLSCompliant(
false)]
static double Atan(double d)
static double Acos(double d)
static double Cos(double d)
static double Exp(double d)
static double Tanh(double value)
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Asin(double d)
static double Pow(double x, double y)
static double Log(double d)
static double Abs(double value)
static double Sin(double a)
static Complex operator-(Complex value)
static Complex Multiply(double left, Complex right)
static Complex Add(Complex left, double right)
static Complex Sinh(Complex value)
string ToString(string? format, IFormatProvider? provider)
static bool IsFinite(Complex value)
readonly double m_imaginary
static bool operator!=(Complex left, Complex right)
static Complex Add(double left, Complex right)
static readonly Complex NaN
static Complex Acos(Complex value)
static Complex Tan(Complex value)
static bool operator==(Complex left, Complex right)
static Complex Tanh(Complex value)
static Complex Subtract(Complex left, Complex right)
static Complex Log(Complex value, double baseValue)
static readonly double s_sqrtRescaleThreshold
static Complex Cos(Complex value)
override int GetHashCode()
static Complex Multiply(Complex left, Complex right)
static Complex Reciprocal(Complex value)
static Complex Sqrt(Complex value)
static Complex Log10(Complex value)
static Complex Divide(Complex dividend, double divisor)
static Complex Multiply(Complex left, double right)
static double Log1P(double x)
static Complex Subtract(Complex left, double right)
static Complex operator/(Complex left, Complex right)
static Complex Exp(Complex value)
override bool Equals([NotNullWhen(true)] object? obj)
static Complex operator*(Complex left, Complex right)
string ToString(IFormatProvider? provider)
static Complex Sin(Complex value)
static Complex FromPolarCoordinates(double magnitude, double phase)
static Complex Cosh(Complex value)
Complex(double real, double imaginary)
static readonly Complex Infinity
static Complex Negate(Complex value)
static Complex operator+(Complex left, Complex right)
static Complex Atan(Complex value)
static bool IsNaN(Complex value)
static Complex Scale(Complex value, double factor)
static Complex Add(Complex left, Complex right)
string ToString(string? format)
static Complex Divide(Complex dividend, Complex divisor)
static bool IsInfinity(Complex value)
static void Asin_Internal(double x, double y, out double b, out double bPrime, out double v)
static Complex Asin(Complex value)
static readonly Complex Zero
static readonly double s_asinOverflowThreshold
static Complex Divide(double dividend, Complex divisor)
static double Abs(Complex value)
static Complex Conjugate(Complex value)
static readonly double s_log2
static readonly Complex One
bool Equals(Complex value)
static Complex Subtract(double left, Complex right)
override string ToString()
static Complex Pow(Complex value, Complex power)
static Complex Pow(Complex value, double power)
static readonly Complex ImaginaryOne
static Complex Log(Complex value)
static double Hypot(double a, double b)