コード例 #1
0
def test_complex():
    AreEqual(
        Complex.Add(Complex(BigInteger(9999L), -1234),
                    Complex.Conjugate(Complex(9999, -1234))),
        Complex.Multiply(BigInteger(9999L), 2))
    AreEqual(
        Complex.Add(Complex(99999.99e-200, 12345.88e+100),
                    Complex.Negate(Complex(99999.99e-200, 12345.88e+100))),
        Complex.Subtract(Complex(99999.99e-200, 12345.88e+100),
                         Complex(99999.99e-200, 12345.88e+100)))
    AreEqual(Complex.Divide(4 + 2j, 2), (2 + 1j))
    Assert(not hasattr(
        Complex,
        "Mod"))  #IP 1.x had limited support for modulo which has been removed
コード例 #2
0
 def test_complex(self):
     from System.Numerics import BigInteger, Complex
     self.assertEqual(
         Complex.Add(Complex(BigInteger(9999L), -1234),
                     Complex.Conjugate(Complex(9999, -1234))),
         Complex.Multiply(BigInteger(9999L), 2))
     self.assertEqual(
         Complex.Add(Complex(99999.99e-200, 12345.88e+100),
                     Complex.Negate(Complex(99999.99e-200, 12345.88e+100))),
         Complex.Subtract(Complex(99999.99e-200, 12345.88e+100),
                          Complex(99999.99e-200, 12345.88e+100)))
     self.assertEqual(Complex.Divide(4 + 2j, 2), (2 + 1j))
     self.assertTrue(
         not hasattr(Complex, "Mod")
     )  #IP 1.x had limited support for modulo which has been removed