當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


C# Math.Sinh()用法及代碼示例


Math.Sinh()是內置的Math類方法,它返回給定雙值參數(指定角度)的雙曲正弦值。

用法:

public static double Sinh(double num)

參數:


  • num:它是要返回其雙曲正弦的數字,並且此參數的類型為System.Double。

返回值:該方法返回num類型為System.Double的雙曲正弦值。如果num等於NegativeInfinity,PositiveInfinity或NaN,則此方法返回一個等於num的Double。

Input  : num = 60.0
Output : 5.71003695E25

以下示例程序旨在說明Math.Sinh方法:

示例1:

// C# program to illustrate the 
// Math.Sinh() 
using System; 
  
class GFG { 
  
    // Main Method 
    public static void Main(String[] args) 
    { 
  
        double num1 = 78.8, num2 = 0.0, num3 = 1.0; 
  
        // It returns the hyperbolic sine of specified  
        // angle in radian 
        double sinhvalue = Math.Sinh(num1); 
        Console.WriteLine("The sinh of num1 = " + sinhvalue); 
  
        sinhvalue = Math.Sinh(num2); 
        Console.WriteLine("The sinh of num2 = " + sinhvalue); 
  
        sinhvalue = Math.Sinh(num3); 
        Console.WriteLine("The sinh of num3 = " + sinhvalue); 
    } 
}
輸出:
The sinh of num1 = 8.34401696285252E+33
The sinh of num2 = 0
The sinh of num3 = 1.1752011936438

示例2:

// C# praogram to illustrate the 
// Math.Sinh() Method 
using System; 
  
class GFG { 
  
    // Main Method 
    public static void Main(String[] args) 
    { 
  
        double num1 = (30 * (Math.PI)) / 180, num2 = 11.0, num3 = 45.0; 
  
        // It returns the hyperbolic sine of  
        // angle in radian 
        double sinhvalue = Math.Sinh(num1); 
        Console.WriteLine("The sinh of num1 = " + sinhvalue); 
  
        sinhvalue = Math.Sinh(num2); 
        Console.WriteLine("The sinh of num2 = " + sinhvalue); 
  
        sinhvalue = Math.Sinh(num3); 
        Console.WriteLine("The sinh of num3 = " + sinhvalue); 
    } 
}
輸出:
The sinh of num1 = 0.54785347388804
The sinh of num2 = 29937.0708492481
The sinh of num3 = 1.74671355287425E+19


相關用法


注:本文由純淨天空篩選整理自Akanksha_Rai大神的英文原創作品 C# | Math.Sinh() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。