strictmath_Java StrictMath asin()方法与示例

strictmath

StrictMath类的asin()方法 (StrictMath Class asin() method)

  • asin() method is available in java.lang package.

    asin()方法在java.lang包中可用。

  • asin() method is used to return the arc sine of the given parameter in the method. Here, asin stands for arc sine of an angle.

    asin()方法用于返回方法中给定参数的反正弦值。 在此,asin代表一定角度的反正弦。

  • asin() method is a static method so it is accessible with the class name and if we try to access the method with the class object then we will not get an error.

    asin()方法是静态方法,因此可以使用类名称进行访问,如果尝试使用类对象访问该方法,则不会收到错误。

  • 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 arcsine 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 – represents a double type value whose arc sine value to be found.

    double d –表示其反正弦值的double类型值。

Return value:

返回值:

The return type of this method is double – it returns the arc sine of given angle.

此方法的返回类型为double-返回给定角度的反正弦

Note:

注意:

  • If we pass NaN as an argument, method returns the same value (NaN).

    如果我们将NaN作为参数传递,则方法将返回相同的值(NaN)。

  • If we pass an argument whose absolute value is greater than 1, method returns NaN.

    如果我们传递一个绝对值大于1的参数,则方法返回NaN。

Example:

例:

// Java program to demonstrate the example
// of asin(double d) method of StrictMath Class.

public class Asin {
    public static void main(String[] args) {
        // variable declarations
        double a1 = 100;
        double a2 = Math.PI / 2;
        double a3 = 0;

        // Display previous value of a1, a2 and a3
        System.out.println("a1: " + a1);
        System.out.println("a2: " + a2);
        System.out.println("a3: " + a3);

        // Here , we will get NaN because we are 
        // passing parameter whose absolute value is 
        // greater than 1
        System.out.println("StrictMath.asin(a1): " + StrictMath.asin(a1));

        // By using toRadians() method is used to convert
        // absolute to radians
        a2 = StrictMath.toRadians(a2);

        // Display the value of a2 in radians form
        System.out.println("StrictMath.toRadians(a2): " + a2);

        // Here we will find arc sine of a2 by using asin() method
        System.out.println("StrictMath.asin(a2): " + StrictMath.asin(a2));

        // Here , we will get 0 because we are passing 
        // parameter whose absolute value is 0
        System.out.println("StrictMath.asin(a3): " + StrictMath.asin(a3));
    }
}

Output

输出量

a1: 100.0
a2: 1.5707963267948966
a3: 0.0
StrictMath.asin(a1): NaN
StrictMath.toRadians(a2): 0.027415567780803774
StrictMath.asin(a2): 0.02741900326072046
StrictMath.asin(a3): 0.0


翻译自: https://www.includehelp.com/java/strictmath-asin-method-with-example.aspx

strictmath

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值