Java tan()方法具有哪些功能呢?
Java tan()方法的功能
Math.tan()方法的功能:用于返回指定double值的正切值
tan()方法的语法
double tan(double d)
参数
d-double数据类型
返回值
- 此方法返回指定
double值的正切值
public class testClass{
public static void main(String args[]) {
double d= 45.0;
double r= Math.toRadians(d);
System.out.format(" pi is %.4f%n", Math.PI);
System.out.format("The tangent of %.1f degrees is %.4f%n", d, Math.cos(r));
}
}
/*
以上代码运行后,将输出以下信息
pi is 3.1416
The tangent of 45.0 degrees is 1.0000
*/
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


