Java exp()方法

Java exp()方法

Java Math.exp()方法,用于计算自然常数e的参数指定的次方。Math.exp()的语法如下:

double exp(double d)

exp()参数

参数描述
ddouble类型。

exp()参数源码介绍

If the argument is NaN, the result is NaN.
If the argument is positive infinity, then the result is positive infinity.
If the argument is negative infinity, then the result is positive zero.
If the argument is zero, then the result is 1.0.

exp()返回值

如果参数为n,返回值则为e的n次方。

exp()实例代码

public class test {
    public static void main(String[] args) {
        double x = 2.0;
        double y = Math.exp(x);
        
        System.out.println("e的2.0次方为:"+y);

    }

}

免责声明:内容仅供参考,不保证正确性。


全栈后端 / Java教程 :









Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.