Java tan() 方法

Java 教程 · 2019-02-08 14:42:58

tan() 方法用于返回指定double类型参数的正切值。

语法

double tan(double d)

参数

  • d -- 任何原生数据类型。

返回值

返回指定double类型参数的正切值。

实例

public class Test{
    public static void main(String args[]){

        double degrees = 45.0;
        double radians = Math.toRadians(degrees);

        System.out.format("pi 的值为 %.4f%n", Math.PI);
        System.out.format("%.1f 度的正切值是 %.4f%n", degrees, Math.tan(radians));

    }
}

编译以上程序,输出结果为:

pi 的值为 3.1416
45.0 度的正切值是 1.0000

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

Responsive Web Design

Responsive Web Design

Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00

From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具