Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

เมธอด Math.Sinh() ใน C#

เมธอด Math.Sinh() ใน C# ใช้สำหรับคืนค่าไซน์ไฮเปอร์โบลิก (hyperbolic sine) ของมุมที่ระบุ

ไวยากรณ์

ไวยากรณ์มีดังนี้:

public static double Sinh(double val)

พารามิเตอร์ val คือมุมในเรเดียน

ตัวอย่าง

ตัวอย่างการใช้งานเมธอด Math.Sinh():

using System; 
public class Demo { 
    public static void Main(){ 
        double val1 = 30.0; 
        double val2 = 45.0; 
        Console.WriteLine(Math.Sinh(val1)); 
        Console.WriteLine(Math.Sinh(val2)); 
    } 
}

ผลลัพธ์

โค้ดจะแสดงผลดังนี้:

5343237290762.23 
1.74671355287425E+19

ตัวอย่างเพิ่มเติม

ตัวอย่างที่สองกับค่าเล็ก:

using System; 
public class Demo { 
    public static void Main(){ 
        double val1 = 0.0; 
        double val2 = 1.1; 
        Console.WriteLine(Math.Sinh(val1)); 
        Console.WriteLine(Math.Sinh(val2)); 
    } 
}

ผลลัพธ์

โค้ดจะแสดงผลดังนี้:

0 
1.33564747012418