Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C#

Phương thức MathF.Cosh() trong C#

Phương thức MathF.Cosh() trong C# trả về cosin hyperbolic của một giá trị float.

Cú pháp

public static float Cosh (float val);

Tham số val là số float.

Ví dụ

using System; 
class Demo { 
    public static void Main(){ 
        float val = 45.0f; 
        float res = MathF.Cosh(val); 
        Console.WriteLine("Cosh = " + res); 
    } 
}

Kết quả

Cosh = 1.746714E+19

Ví dụ khác

using System; 
class Demo { 
    public static void Main(){ 
        float val = 90f; 
        float res = MathF.Cosh(val); 
        Console.WriteLine("Cosh = " + res); 
    } 
}

Kết quả

Cosh = Infinity