文字

tan

(PHP 4, PHP 5)

tan正切

说明

float tan ( float $arg )

tan() 返回参数 arg 的正切值。参数 arg 的单位为弧度。

参数

arg

要处理的以弧度为单位的参数

返回值

arg 的正切值

范例

Example #1 tan() 例子

<?php

echo  tan ( M_PI_4 );  // 1

?>

参见

  • atan() - 反正切
  • atan2() - 两个参数的反正切
  • sin() - 正弦
  • cos() - 余弦
  • tanh() - 双曲正切
  • deg2rad() - 将角度转换为弧度

用户评论:

[#1] farba36 at yahoo dot com [2014-10-31 21:30:13]

Kotanjant i?in ba?ka bir ??z??m
<?php
$degrees 
30;
echo 
"$degrees derecelik a??n?n kotanjant de?eri: " 1/tan(deg2rad($degrees));
?>

[#2] georgedot at gmail dot com [2009-09-10 13:50:04]

Workaround for cotangent function

<?php
//FOR PHP 4
function cot($rad)
{
    return 
tan(M_PI_2 rad2deg($rad));
}

//FOR PHP 3
function cot($rad)
{
    return 
tan(M_PI/rad2deg($rad));
}
?>

上一篇: 下一篇: