当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


PHP asin()用法及代码示例


asin() 函数是预定义的三角函数 PHP 函数。它用于计算三角学问题。它返回一个介于 -1 和 1 之间的数字的反正弦。

用法:

asin($value)
参数 描述 必需/可选
number 指定一个介于 -1 到 1 之间的数字 Required

注意:asin(1) 返回 Pi/2 的值。

示例 1

<?php
$num=0 ;
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:0
By using 'asin()' function your number is:0

例2

<?php
$num=1;
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:1
By using 'asin()' function your number is:1.5707963267949

例3

<?php
$num=-1;
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:-1
By using 'asin()' function your number is:-1.5707963267949

例4

<?php
$num=(-0.4);
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:-0.4
By using 'asin()' function your number is:-0.41151684606749

例5

<?php
$num=(0.64);
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:0.64
By using 'asin()' function your number is:0.69449826562656

例6

<?php
$num=2;
echo "Your number is:".$num;
echo "<br>"."By using 'asin()' function your number is:".(asin($num));
?>

输出:

Your number is:2
By using 'asin()' function your number is:NAN






相关用法


注:本文由纯净天空筛选整理自 PHP asin() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。