本文共 3352 字,大约阅读时间需要 11 分钟。
math asin
This method is available in java.lang package.
此方法在java.lang包中可用。
This method is used to return the arc sine of the given parameter in the method.
此方法用于返回方法中给定参数的反正弦值。
In this method, asin stands for arc sine of an angle.
在这种方法中, asin代表一个角度的反正弦 。
This method is static so this method is accessible with classname too.
此方法是静态的,因此也可以使用类名访问此方法。
The return type of this method is double that means it returns the arc sine of the given angle is of the double datatype.
此方法的返回类型为double,这意味着它返回给定角度的反正弦为double数据类型。
In this method, we pass only one parameter as an argument in the method of Math class.
在此方法中,我们仅将一个参数作为参数传递给Math类的方法。
In this method, we pass only radians type argument (i.e. First we convert given argument in radians by using toRadians() method of Math class then after we will pass the same variable in asin() method).
在此方法中,我们仅传递弧度类型的参数(即,首先,通过使用Math类的toRadians()方法将给定的参数转换为弧度,然后在asin()方法中传递相同的变量)。
This method does not throw any exception.
此方法不会引发任何异常。
In this method, the meaning of arc sine is the inverse or reverse sine of the given argument.
在此方法中,反正弦的含义是给定参数的反正弦或反正弦。
The range of asin() lies –PI/2 through PI/2.
asin()的范围介于–PI / 2至PI / 2之间 。
Syntax:
句法:
public static double asin(double d){ }
Parameter(s):
参数:
double d – It's the value of an angle in radians.
double d –以弧度为单位的角度值。
Note:
注意:
If we pass "NaN" (Not A Number) to the function, it returns "NaN".
如果我们将“ NaN”(非数字)传递给函数,它将返回“ NaN”。
If we pass the value whose absolute value is greater than 1, it returns "NaN".
如果我们传递的绝对值大于1的值,则返回“ NaN”。
Return value:
返回值:
The return type of this method is double, it returns the arc sine of the given angle.
此方法的返回类型为double ,它返回给定角度的反正弦值。
// Java program to demonstrate the behavior of // acos(double d) method of Math Class.class AcosMethod { public static void main(String[] args) { // Here we are declaring few variables double a1 = 100; double a2 = Math.PI / 2; // Display previous value of a1 and a2 System.out.println(" Before implementing acos() so the value of a1 is :" + a1); System.out.println(" Before implementing acos() so the value of a2 is :" + a2); // Here , we will get NaN because we are passing parameter // whose absolute value is greater than 1 System.out.println("After implementing acos() so the value of a1 is :" + Math.acos(a1)); // By using toRadians() method is used to convert // absolute to radians a2 = Math.toRadians(a2); // Display the value of a2 in radians form System.out.println("After implementing toRadians() so the value of a2 is :" + a2); // Here we will find arc cosine of a2 by using acos() method System.out.println("After implementing acos() so the value of a2 is :" + Math.acos(a2)); }}
Output
输出量
E:\Programs>javac AcosMethod.javaE:\Programs>java AcosMethodBefore implementing acos() so the value of a1 is :100.0Before implementing acos() so the value of a2 is :1.5707963267948966After implementing acos() so the value of a1 is :NaNAfter implementing toRadians() so the value of a2 is :0.027415567780803774After implementing acos() so the value of a2 is :1.5433773235341761
翻译自:
math asin
转载地址:http://vkvzd.baihongyu.com/