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


JavaScript Math acosh()用法及代碼示例

Javascript Math.acosh() 函數用於返回數字的雙曲反餘弦值。 Math.acosh (x) = arcosh(x) = y ≧ 0 使得 cosh (y)=x acosh() 是 Math 的靜態方法,因此它始終用作 Math.acosh(),而不是用作方法創建的 Math 對象的。

用法:

Math.acosh(value)

參數:該函數接受單個參數。

  • value:您想知道哪個數字的雙曲反餘弦值。

返回:它返回給定數字的雙曲反餘弦值,如果傳遞的參數小於 1,則返回 NaN。

示例 1:當 1 作為參數傳遞時。

Javascript


<script type="text/javascript"> 
    console.log("Output : " + Math.acosh(1)); 
</script>

輸出:

Output : 0

示例 2:當 0 作為參數傳遞時。

Javascript


<script type="text/javascript"> 
    console.log("Output : " + Math.acosh(0)); 
</script>

輸出:

Output : NaN

示例 3:當小於 0 的數字作為參數傳遞時。

Javascript


<script type="text/javascript"> 
    console.log("Output : " + Math.acosh(-1)); 
</script>

輸出:

Output : NaN

示例4:當 2 作為參數傳遞時。

Javascript


<script type="text/javascript"> 
    console.log("Output : " + Math.acosh(2)); 
</script>

輸出:

Output : 1.3169578969248166

我們有 Javascript 數學對象方法的完整列表,要檢查這些方法,請閱讀這篇 Javascript 數學對象完整參考文章。

支持的瀏覽器:

  • 穀歌瀏覽器 1 及以上版本
  • Internet Explorer 3 及更高版本
  • 火狐瀏覽器1及以上版本
  • Opera 3 及以上版本
  • Safari 1 及以上版本


相關用法


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