float tan ( float $arg )
tan() returns the tangent of $arg. The $arg is in radians.
※ available F/W version : all
Returns the tangent of $arg
<?php
$y = 1.0;$x = 2.0;
$y3 = -1.0;$x3 = -2.0;
$rad = $y/$x;
$val1 = atan($rad);
$val2 = atan2($y, $x);
$val3 = atan2($y3, $x3);
$val4 = tan($val1);
echo "atan($rad) = $val1\r\n"; // OUTPUT: atan(0.5) = 0.46364760900081
echo "atan2($y, $x) = $val2\r\n"; // OUTPUT: atan2(1, 2) = 0.46364760900081
echo "atan2($y3, $x3) = $val3\r\n"; // OUTPUT: atan2(-1, -2) = -2.677945044589
echo "tan($val1) = $val4\r\n"; // OUTPUT: tan(0.46364760900081) = 0.5
?>
This function is identical to the PHP group’s tan() function.