Home  >  Article  >  Web Front-end  >  javascript asin 方法计算反正弦值

javascript asin 方法计算反正弦值

WBOY
WBOYOriginal
2016-06-01 09:54:451411browse

asin 方法返回数字的反正弦值。

基本语法

<code class="language-javascript">Math.asin(number)</code>

必选项number参数是需要计算反正弦的数值表达式。

返回值

返回值为数字参数的反正弦值(-PI/2 到 PI/2 之间的弧度值)。

需要注意的几点:

  1. 如果参数 x 超过了 -1.0 ~ 1.0 的范围,那么浏览器将返回 NaN。
  2. 如果参数是非数字,则返回NaN。
  3. 如果参数 x 取值 1,那么将返回 PI/2。

实例

<code class="language-javascript"><script type="text/javascript">

document.write(Math.asin(0.5) + "<br />")
document.write(Math.asin(0) + "<br />")
document.write(Math.asin(-1) + "<br />")
document.write(Math.asin(1) + "<br />")
document.write(Math.asin(8) + "<br />")
document.write(Math.asin("d"))

</script></code>

在线运行

运行结果:

<code class="language-javascript">0.5235987755982989
0
-1.5707963267948966
1.5707963267948966
NaN
NaN</code>

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn