Get the hyperbolic arc-cosine of a floating-point value in C#

CsharpServer Side ProgrammingProgramming

To get the hyperbolic arc-cosine of a floating-point value, the code is as follows −

Example

using System;
public class Demo {
   public static void Main() {
      float val1 = 0.1f;
      float val2 = 0.9f;
      Console.WriteLine("Angle (val1) = "+(MathF.Acosh(val1)));                          
      Console.WriteLine("Angle (val2) = "+(MathF.Acosh(val2)));
   }
}

Output

This will produce the following output −

Angle (val1) = NaN
Angle (val2) = NaN

Example

Let us see another example −

using System;
public class Demo {
   public static void Main() {
      float val1 = 5.1f;
      float val2 = 8.9f;
      Console.WriteLine("Angle (val1) = "+(MathF.Acosh(val1)));
      Console.WriteLine("Angle (val2) = "+(MathF.Acosh(val2)));
   }
}

Output

This will produce the following output −

Angle (val1) = 2.312634
Angle (val2) = 2.876027
raja
Published on 11-Dec-2019 11:08:45
Advertisements