java.lang.StrictMath.sin()%uA0方法返回一个角度的正弦值。它包括以下情况:
- 如果参数为NaN或无穷大,那么结果为NaN。
- 如果参数是零,那么结果是参数为零相同的符号。
声明
以下是java.lang.StrictMath.sin()方法的声明
public static double sin(double a)
参数
-
a%uA0-- 这是一个角度,以弧度为单位。
返回值
这个方法返回参数的正弦值。
异常
-
NA
例子
下面的例子显示java.lang.StrictMath.sin()方法的使用。
package com.yiibai import java.lang.* public class StrictMathDemo { public static void main(String[] args) { double d1 = (90*Math.PI)/180 , d2 = 0.0, d3 = (1.0/0.0) // returns the trigonometric sine of an angle double sinValue = StrictMath.sin(d1) System.out.println("Trigonometric sine of d1 = " + sinValue) sinValue = StrictMath.sin(d2) System.out.println("Trigonometric sine of d2 = " + sinValue) sinValue = StrictMath.sin(d3) System.out.println("Trigonometric sine of d3 = " + sinValue) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Trigonometric sine of d1 = 1.0 Trigonometric sine of d2 = 0.0 Trigonometric sine of d3 = NaN