System.Numerics.Tests.ComplexTests.Reciprocal C# (CSharp) Method

Reciprocal() private method

private Reciprocal ( double real, double imaginary ) : void
real double
imaginary double
return void
        public static void Reciprocal(double real, double imaginary)
        {
            var complex = new Complex(real, imaginary);
            var result = Complex.Reciprocal(complex);

            Complex expected = Complex.Zero;
            if (Complex.Zero != complex &&
                !(double.IsInfinity(real) && !(double.IsInfinity(imaginary) || double.IsNaN(imaginary))) &&
                !(double.IsInfinity(imaginary) && !(double.IsInfinity(real) || double.IsNaN(real))))
            {
                double magnitude = complex.Magnitude;
                expected = Complex.Conjugate(complex) / magnitude; // In order to avoid Infinity = magnitude* magnitude
                expected /= magnitude;
            }

            VerifyRealImaginaryProperties(result, expected.Real, expected.Imaginary);
        }
ComplexTests