public static void Main() { // <Snippet6> double n1 = 16.33; System.Numerics.Complex c1 = new System.Numerics.Complex(16.33, 0); Console.WriteLine(c1.Equals(n1)); // Returns true. // </Snippet6> }
private static void TestForEquality() { // <Snippet4> System.Numerics.Complex c1 = new System.Numerics.Complex(3.33333, .142857); System.Numerics.Complex c2 = new System.Numerics.Complex(10 / 3.0, 1.0 / 7); Console.WriteLine("{0} = {1}: {2}", c1, c2, c1.Equals(c2)); // The example displays the following output: // (3.33333, 0.142857) = (3.33333333333333, 0.142857142857143): False // </Snippet4> }
public static bool IsZero(this Complex self) { return(self.Equals(Complex.Zero)); }
public void Equals_equal_objects_return_true() { Assert.True(_c1.Equals((object)new Complex(1, -2))); }