Java Math sin() 方法

定义和用法

sin() 方法返回角的正弦值。

注意:角度以弧度为单位测量。

提示:您可以使用常量 Math.PI 来生成角度的 PI 分数。

实例

返回不同角度的正弦值:

System.out.println(Math.sin(3));
System.out.println(Math.sin(-3));
System.out.println(Math.sin(0));
System.out.println(Math.sin(Math.PI));
System.out.println(Math.sin(Math.PI/2));

亲自试一试

语法

public static double sin(double angle)

参数

参数 描述
angle 必需。需要求正弦的角度值(以弧度为单位)。

技术细节

返回: 表示角度正弦值的 double 值。
Java 版本: 任意版本。