PHP atan2() 也是預定義的三角函數,用於返回兩個變量 x 和 y 的反正切或者用 atan2() 函數返回不同 (x,y) 點的角度 theta。
注:y/x 的反正切,以弧度表示,在 -Pi 和 Pi 之間。
用法:
atan2(y,x);
參數 | 描述 | 必需/可選 |
---|---|---|
X | 指定被除數 | Required |
Y | 指定除數 | Required |
例子1
<?php
echo "Your number is:(0.50,0.50)";
echo "<br>"."By using 'atan2()' function your number is:".(atan2(0.50,0.50));
?>
輸出:
Your number is:(0.50,0.50) By using 'atan2()' function your number is:0.78539816339745
例子2
<?php
echo "Your number is:(-0.50,-0.50)";
echo "<br>"."By using 'atan2()' function your number is:".(atan2(0.50,0.50));
?>
輸出:
Your number is:(-0.50,-0.50) By using 'atan2()' function your number is:0.78539816339745
例子3
<?php
echo "Your number is:(5,5)";
echo "<br>"."By using 'atan2()' function your number is:".(atan2(5,5));
?>
輸出:
Your number is:(5,5) By using 'atan2()' function your number is:0.78539816339745
示例 4
<?php
echo "Your number is:(-5,-5)";
echo "<br>"."By using 'atan2()' function your number is:".(atan2(-5,-5));
?>
輸出:
Your number is:(-5,-5) By using 'atan2()' function your number is:-2.3561944901923
例 5
<?php
echo "Your number is:(-5,5)";
echo "<br>"."By using 'atan2()' function your number is:".(atan2(-5,5));
?>
輸出:
Your number is:(-5,5) By using 'atan2()' function your number is:-0.78539816339745
相關用法
- PHP atan2( )用法及代碼示例
- PHP atanh()用法及代碼示例
- PHP atan()用法及代碼示例
- PHP atanh( )用法及代碼示例
- PHP atan( )用法及代碼示例
- PHP PHPUnit assertIsNotFloat()用法及代碼示例
- PHP array_reverse()用法及代碼示例
- PHP PHPUnit assertStringStartsWith()用法及代碼示例
- PHP PHPUnit assertIsObject()用法及代碼示例
- PHP PHPUnit assertNotIsReadable()用法及代碼示例
- PHP array_filter()用法及代碼示例
- PHP PHPUnit assertNotNull()用法及代碼示例
- PHP array_pop()用法及代碼示例
- PHP PHPUnit assertEqualsIgnoringCase()用法及代碼示例
- PHP asort()用法及代碼示例
- PHP array_diff_uassoc()用法及代碼示例
- PHP PHPUnit assertIsNotScalar()用法及代碼示例
- PHP array_intersect_key()用法及代碼示例
- PHP array_key_first()用法及代碼示例
- PHP PHPUnit assertDirectoryNotIsWritable()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP atan2() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。