目录

static double atan(double a)

描述 (Description)

java.lang.Math.atan(double a)返回角度的反正切,范围为-pi/2到pi/2。 特殊情况 -

  • 如果参数是NaN,则结果为NaN。

  • 如果参数为零,则结果为零,其参数符号相同。

结果必须在正确舍入结果的1 ulp内。 结果必须是半单调的。

声明 (Declaration)

以下是java.lang.Math.atan()方法的声明

public static double atan(double a)

参数 (Parameters)

a - 要返回其反正切值的值。

返回值 (Return Value)

此方法返回参数的反正切。

异常 (Exception)

NA

例子 (Example)

以下示例显示了lang.Math.atan()方法的用法。

package com.iowiki;
import java.lang.*;
public class MathDemo {
   public static void main(String[] args) {
      // get a variable x which is equal to PI/2
      double x = Math.PI/2;
      // convert x to radians
      x = Math.toRadians(x);
      // get the arc tangent of x
      System.out.println("Math.atan(" + x + ")" + Math.atan(x));
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

Math.atan(0.027415567780803774)0.0274087022410345
↑回到顶部↑
WIKI教程 @2018