java acos耗时_Java Math类静态double acos(double d)方法与示例

java acos耗时

数学类静态double acos(double d) (Math Class static double acos(double d))

  • This method is available in java.lang package.

    此方法在java.lang包中可用。

  • This method is used to return the arc cosine of the given parameter in the method. 

    此方法用于返回方法中给定参数的反余弦值。

  • In this method, acos stands for arc cosine of an angle.

    在这种方法中, acos代表一个角度的反余弦

  • 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 cosine 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 acos() method). 

    在此方法中,我们仅传递弧度类型的参数(即,首先,我们使用Math类的toRadians()方法将给定的参数转换为弧度,然后在acos()方法中传递相同的变量)。

  • This method does not throw any exception.

    此方法不会引发任何异常。

  • In this method, the meaning of arc cosine is the inverse or reverse cosine of the given argument.

    在这种方法中,反余弦的含义是给定参数的反余弦。

  • The range of acos() lies 0.0 through PI.

    acos()的范围通过PI为0.0。

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 cosine of the given angle.

此方法的返回类型为double ,它返回给定角度的反余弦值。

Java程序演示asin(double d)方法的示例 (Java program to demonstrate example of asin(double d) method)

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

class AsinMethod {
    public static void main(String[] args) {
        // Here we are declaring few variables
        double a1 = 100;
        double a2 = Math.PI / 2;
        double a3 = 0;

        // Display previous value of a1, a2 and a3
        System.out.println(" Before implementing asin() so the value of a1 is :" + a1);
        System.out.println(" Before implementing asin() so the value of a2 is :" + a2);
        System.out.println(" Before implementing asin() so the value of a3 is :" + a3);

        // Here , we will get NaN because we are passing parameter 
        // whose absolute value is greater than 1
        System.out.println("After implementing asin() so the value of a1 is :" + Math.asin(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 sine of a2 by using asin() method
        System.out.println("After implementing asin() so the value of a2 is :" + Math.asin(a2));

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

Output

输出量

E:\Programs>javac AsinMethod.java

E:\Programs>java AsinMethod
Before implementing asin() so the value of a1 is :100.0
Before implementing asin() so the value of a2 is :1.5707963267948966
Before implementing asin() so the value of a3 is :0.0
After implementing asin() so the value of a1 is :NaN
After implementing toRadians() so the value of a2 is :0.027415567780803774
After implementing asin() so the value of a2 is :0.02741900326072046
After implementing asin() so the value of a3 is :0.0


翻译自: https://www.includehelp.com/java/math-class-static-double-acos-double-d-method-with-example.aspx

java acos耗时

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值