Example #1
0
        public void Cosh()
        {
            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.Cosh(cd1);

            Assert.AreEqual(cdt.Real, -.982, TOLERENCE);
            Assert.AreEqual(cdt.Imag, -1.08, TOLERENCE);

            cdt = ComplexMath.Cosh(cd2);
            Assert.AreEqual(cdt.Real, -0.589, TOLERENCE);
            Assert.AreEqual(cdt.Imag, 0, TOLERENCE);

            cdt = ComplexMath.Cosh(cd3);
            Assert.AreEqual(cdt.Real, 1.669, TOLERENCE);
            Assert.AreEqual(cdt.Imag, 0, TOLERENCE);

            cdt = ComplexMath.Cosh(cd4);
            Assert.AreEqual(cdt.Real, -.982, TOLERENCE);
            Assert.AreEqual(cdt.Imag, -1.08, TOLERENCE);

            ComplexFloat cft = ComplexMath.Cosh(cf1);

            Assert.AreEqual(cft.Real, -.982, TOLERENCE);
            Assert.AreEqual(cft.Imag, -1.08, TOLERENCE);

            cft = ComplexMath.Cosh(cf2);
            Assert.AreEqual(cft.Real, -0.589, TOLERENCE);
            Assert.AreEqual(cft.Imag, 0, TOLERENCE);

            cft = ComplexMath.Cosh(cf3);
            Assert.AreEqual(cft.Real, 1.669, TOLERENCE);
            Assert.AreEqual(cft.Imag, 0, TOLERENCE);

            cft = ComplexMath.Cosh(cf4);
            Assert.AreEqual(cft.Real, -.982, TOLERENCE);
            Assert.AreEqual(cft.Imag, -1.08, TOLERENCE);
        }