PHP - atan
Trieda
Metóda - atan
(PHP 4, PHP 5, PHP 7)
The function atan() returns a value of the goniometric function
arc tangent. The arc tangent is the inverted value of the tangent (often
referred as tan−1). It allows us to get back the angle, which means
that a == tan(atan(a)).
Procedurálne
- function atan (float $arg) : float
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $arg | float | The value of tangent. |
Mávratovej hodnoty
Vracia: float
The resulting angle in radians.
Príklady
<?php
// each 15° till 180
for ($i = 0; $i <= 180; $i += 15) {
$tan = tan(deg2rad($i)); // converts the angle into radians and calculates its tangent
$deg = rad2deg(atan($tan)); // calculates the angle in radians using the previous value and then converts it into degrees
echo("tan({$i}°) = $tan ---> atan($tan) = {$deg}°<br />");
}
