เมธอด MathF.Cosh() ใน C# ใช้เพื่อคืนค่าไฮเปอร์โบลิกโคไซน์ของค่าทศนิยม
ไวยากรณ์
ต่อไปนี้เป็นไวยากรณ์ -
public static float Cosh (float val);
ด้านบน Val คือเลขทศนิยม
ตัวอย่าง
ให้เรามาดูตัวอย่างการใช้งาน MathF.Cosh() method −
using System;
class Demo {
public static void Main(){
float val = 45.0f;
float res = MathF.Cosh(val);
Console.WriteLine("Cosh = "+res);
}
} ผลลัพธ์
สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้ -
Cosh = 1.746714E+19
ตัวอย่าง
ให้เรามาดูตัวอย่างการใช้งาน MathF.Cosh() method อีกตัวอย่างหนึ่ง -
using System;
class Demo {
public static void Main(){
float val = 90f;
float res = MathF.Cosh(val);
Console.WriteLine("Cosh = "+res);
}
} ผลลัพธ์
สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้ -
Cosh = Infinity