Acosh() публичный статический Метод

Calculates inverse hyperbolic cosine of a {@code double} value.

Special cases:

  • If the argument is NaN, then the result is NaN.
  • If the argument is +1, then the result is a zero.
  • If the argument is positive infinity, then the result is positive infinity.
  • If the argument is less than 1, then the result is NaN.
public static Acosh ( double a ) : double
a double
Результат double
Пример #1
0
        public virtual void TestAcoshMethod()
        {
            // acosh(NaN) == NaN
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(double.NaN)));
            // acosh(1) == +0
            Assert.AreEqual(0, BitConverter.DoubleToInt64Bits(MathUtil.Acosh(1D)));
            // acosh(POSITIVE_INFINITY) == POSITIVE_INFINITY
            Assert.AreEqual(BitConverter.DoubleToInt64Bits(double.PositiveInfinity), BitConverter.DoubleToInt64Bits(MathUtil.Acosh(double.PositiveInfinity)));
            // acosh(x) : x < 1 == NaN
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(0.9D)));                    // x < 1
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(0D)));                      // x == 0
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(-0D)));                     // x == -0
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(-0.9D)));                   // x < 0
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(-1D)));                     // x == -1
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(-10D)));                    // x < -1
            Assert.IsTrue(double.IsNaN(MathUtil.Acosh(double.NegativeInfinity))); // x == -Inf

            double epsilon = 0.000001;

            Assert.AreEqual(0, MathUtil.Acosh(1), epsilon);
            Assert.AreEqual(1.5667992369724109, MathUtil.Acosh(2.5), epsilon);
            Assert.AreEqual(14.719378760739708, MathUtil.Acosh(1234567.89), epsilon);
        }