acos() 函數是用於計算三角問題的有用的預定義 PHP 函數。它用於以弧度為單位查找數字的反餘弦值。
注意:acos(-1) 返回 Pi 的值。
用法:
acos(number);
參數 | 描述 | 必需/可選 |
---|---|---|
Number | 在 -1 到 1 範圍內指定一個數字。 | Required |
示例 1
<?php
$num=0;
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
?>
輸出:
Your number is:0 By using 'acos()' function your number is:1.5707963267949
例2
<?php
$num=1;
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
?>
輸出:
Your number is:1 By using 'acos()' function your number is:0
例3
<?php
$num=2;
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
echo "<br>"." Note:Your number is outside the range [-1,1]";
?>
輸出:
Your number is:2 By using 'acos()' function your number is:NAN Note:Your number is outside the range [-1,1]
例4
<?php
$num=(0.64);
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
?>
輸出:
Your number is:0.64 By using 'acos()' function your number is:0.87629806116834
例5
<?php
$num=(-0.4);
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
?>
輸出:
Your number is:-0.4 By using 'acos()' function your number is:1.9823131728624
例6
<?php
$num=(-1);
echo "Your number is:".$num;
echo "<br>"."By using 'acos()' function your number is:".(acos($num));
?>
輸出:
Your number is:-1 By using 'acos()' function your number is:3.1415926535898
相關用法
- PHP max( )用法及代碼示例
- PHP metaphone()用法及代碼示例
- PHP mhash_get_hash_name()用法及代碼示例
- PHP money_format()用法及代碼示例
- PHP mt_getrandmax()用法及代碼示例
- PHP mkdir()用法及代碼示例
- PHP mhash_keygen_s2k()用法及代碼示例
- PHP microtime()用法及代碼示例
- PHP mt_rand( )用法及代碼示例
- PHP mime_content_type()用法及代碼示例
- PHP mysqli_real_escape_string()用法及代碼示例
- PHP mktime()用法及代碼示例
- PHP mysqli_error()用法及代碼示例
- PHP mkdir( )用法及代碼示例
- PHP mysqli_fetch_array()用法及代碼示例
- PHP mysqli_num_rows()用法及代碼示例
- PHP md5_file()用法及代碼示例
- PHP mysqli_ping()用法及代碼示例
- PHP min( )用法及代碼示例
- PHP mhash_get_block_size()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP math acos() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。