Пример #1
0
        public void Acos()
        {
            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);

            Complex cdt = ComplexMath.Acos(cd1);

            Assert.AreEqual(cdt.Real, 1.1388414556, TOLERENCE);
            Assert.AreEqual(cdt.Imag, 1.618, TOLERENCE);

            cdt = ComplexMath.Acos(cd2);
            Assert.AreEqual(cdt.Real, 1.571, TOLERENCE);
            Assert.AreEqual(cdt.Imag, 1.530, TOLERENCE);

            cdt = ComplexMath.Acos(cd3);
            Assert.AreEqual(cdt.Real, 0, TOLERENCE);
            Assert.AreEqual(cdt.Imag, 0.444, TOLERENCE);

            cdt = ComplexMath.Acos(cd4);
            Assert.AreEqual(cdt.Real, 2.004, TOLERENCE);
            Assert.AreEqual(cdt.Imag, -1.618, TOLERENCE);

            ComplexFloat cft = ComplexMath.Acos(cf1);

            Assert.AreEqual(cft.Real, 1.138, TOLERENCE);
            Assert.AreEqual(cft.Imag, 1.618, TOLERENCE);

            cft = ComplexMath.Acos(cf2);
            Assert.AreEqual(cft.Real, 1.571, TOLERENCE);
            Assert.AreEqual(cft.Imag, 1.530, TOLERENCE);

            cft = ComplexMath.Acos(cf3);
            Assert.AreEqual(cft.Real, 0, TOLERENCE);
            Assert.AreEqual(cft.Imag, 0.444, TOLERENCE);

            cft = ComplexMath.Acos(cf4);
            Assert.AreEqual(cft.Real, 2.004, TOLERENCE);
            Assert.AreEqual(cft.Imag, -1.618, TOLERENCE);
        }