math atan2_Java Math类静态double atan(double d)示例

math atan2

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

  • This method is available in java.lang package.

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

  • This method is used to return the arctangent of an angle of the given parameter in the method.

    此方法用于返回方法中给定参数的角度的反正切。

  • In this method, atan stands for arctangent of an angle.

    在这种方法中,atan代表角度的反正切。

  • This is a static method so this method is accessible with the class name too.

    这是一个静态方法,因此也可以使用类名访问此方法。

  • The return type of this method is double that means it returns the arctangent 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 atan() method).

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

  • This method does not throw any exception.

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

  • In this method, the meaning of arctangent is the inverse or reverse tangent of the given argument.

    在此方法中,反正切的含义是给定参数的反正切或反正切。

  • The range of atan() lies –PI/2 through PI/2.

    atan()的范围是–PI / 2至PI / 2。

Syntax:

句法:

    public static double atan(double d){
    }

Parameter(s):

参数:

double d – A double value in radians whose arctangent to be found.

double d-要找到反正切的弧度的双精度值。

Note:

注意:

  • If we pass "NaN", it returns "NaN".

    如果我们传递“ NaN”,则返回“ NaN”。

  • If we pass zero, it returns the same.

    如果传递零,则返回相同值。

Return value:

返回值:

The return type of this method is double, it returns the arctangent of the given angle.

此方法的返回类型为double ,它返回给定角度的反正切。

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

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

class AtanMethod {
    public static void main(String[] args) {
        // Here we are declaring few variables
        double d1 = -0.0;
        double d2 = Math.PI / 2;

        // Display previous value of d1 and d2
        System.out.println(" Before implementing atan() so the value of d1 is :" + d1);
        System.out.println(" Before implementing atan() so the value of d2 is :" + d2);

        // Here , we will get (-0.0) because we are passing parameter whose absolute value is -0.0
        System.out.println("After implementing atan() so the value of d1 is :" + Math.atan(d1));

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

        // Display the value of d2 in radians form
        System.out.println("After implementing toRadians() so the value of d2 is :" + d2);

        // Here we will find arc tangent of d2 by using atan() method
        System.out.println("After implementing atan() so the value of d2 is :" + Math.atan(d2));
    }
}

Output

输出量

E:\Programs>javac AtanMethod.java

E:\Programs>java AtanMethod
Before implementing atan() so the value of d1 is :-0.0
Before implementing atan() so the value of d2 is :1.5707963267948966
After implementing atan() so the value of d1 is :-0.0
After implementing toRadians() so the value of d2 is :0.027415567780803774
After implementing atan() so the value of d2 is :0.0274087022410345


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

math atan2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值