static double atan(double a)
描述 (Description)
java.lang.StrictMath.atan()方法返回值的反正切。返回的角度在-pi/2 through pi/2的范围内。它包括这些情况 -
- 如果参数是NaN,则结果为NaN。
- 如果参数为零,则结果为零,其参数符号相同。
声明 (Declaration)
以下是java.lang.StrictMath.atan()方法的声明
public static double atan(double a)
参数 (Parameters)
a - 这是要返回反正切的值。
返回值 (Return Value)
此方法返回参数的反正切。
异常 (Exception)
NA
例子 (Example)
以下示例显示了java.lang.StrictMath.atan()方法的用法。
package com.iowiki;
import java.lang.*;
public class StrictMathDemo {
public static void main(String[] args) {
double d1 = 0.20 , d2 = 60.00, d3 = 0;
/* returns the arc tangent of a value, returned angle range is
-pi/2 to pi/2 */
double dAbsValue = StrictMath.atan(d1);
System.out.println("arc tangent of " + d1 + " = " + dAbsValue);
dAbsValue = StrictMath.atan(d2);
System.out.println("arc tangent of " + d2 + " = " + dAbsValue);
dAbsValue = StrictMath.atan(d3);
System.out.println("arc tangent of " + d3 + " = " + dAbsValue);
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
arc tangent of 0.2 = 0.19739555984988078
arc tangent of 60.0 = 1.554131203080956
arc tangent of 0.0 = 0.0