Java sin() 方法

Java 教程 · 2019-02-08 14:12:10

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

语法

double sin(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.sin(radians));

    }
}

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

pi 的值为 3.1416
45.0 度的正弦值为 0.7071

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

查看所有标签

High Performance JavaScript

High Performance JavaScript

Nicholas C. Zakas / O'Reilly Media / 2010-4-2 / USD 34.99

If you're like most developers, you rely heavily on JavaScript to build interactive and quick-responding web applications. The problem is that all of those lines of JavaScript code can slow down your ......一起来看看 《High Performance JavaScript》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

MD5 加密
MD5 加密

MD5 加密工具

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

HEX HSV 互换工具