Beispiel #1
0
        public void Norm()
        {
            Complex      cd1 = new Complex(1.1, -2.2);
            Complex      cd2 = new Complex(0, -2.2);
            Complex      cd3 = new Complex(1.1, 0);
            Complex      cd4 = new Complex(-1.1, 2.2);
            ComplexFloat cf1 = new ComplexFloat(1.1f, -2.2f);
            ComplexFloat cf2 = new ComplexFloat(0, -2.2f);
            ComplexFloat cf3 = new ComplexFloat(1.1f, 0);
            ComplexFloat cf4 = new ComplexFloat(-1.1f, 2.2f);

            Assert.AreEqual(ComplexMath.Norm(cd1), 2.460, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cd2), 2.2, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cd3), 1.1, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cd4), 2.460, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cf1), 2.460, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cf2), 2.2, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cf3), 1.1, TOLERENCE);
            Assert.AreEqual(ComplexMath.Norm(cf4), 2.460, TOLERENCE);
        }