expm1_Java Math类静态double expm1(double d)及其示例
expm1
數學類靜態double expm1(double d) (Math Class static double expm1(double d))
This method is available in java.lang package.
此方法在java.lang包中可用。
This method is used to return [ the exponential of the given number – 1] in the method or in other words it is used to calculate the ( e raised to the power of the given argument – 1).?
此方法用于返回方法中的[給定數字的指數– 1],或換句話說,它用于計算(e升至給定參數的冪– 1)。
In this method, expm stands for exponentiation.?
在此方法中,expm代表求冪。
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 exponentiation of the given argument -1) and the argument and return value are of double type.?
此方法的返回類型為double,表示它返回(給定參數-1的冪),并且參數和返回值均為double類型。
In this method we pass only one parameter as an argument in the method of Math class and the given parameter is the exponent to raise the power of e -1.?
在此方法中,我們僅將一個參數作為參數傳遞給Math類的方法,并且給定參數是提高e -1冪的指數。
This method does not throw any exception.
此方法不會引發任何異常。
Syntax:
句法:
public static double expm1(double d){}Parameter(s):
參數:
double d – A double value whose exponential to be found..
double d –一個要找到其指數的double值。
Note:
注意:
If we pass "NaN" to the function, it returns the "NaN".
如果我們將“ NaN”傳遞給函數,它將返回“ NaN”。
If we pass positive infinity, it returns the positive infinity.
如果我們傳遞正無窮大,它將返回正無窮大。
If we pass negative infinity, it returns -1.0.
如果傳遞負無窮大,則返回-1.0。
If we pass zero (-0 or 0), it returns 0.0.
如果傳遞零(-0或0),則返回0.0。
Return value:
返回值:
The return type of this method is double, it returns the exponentiation of the given value.
此方法的返回類型為double ,它返回給定值的冪。
Java程序演示expm1(double d)方法的示例 (Java program to demonstrate example of expm1(double d) method)
// Java program to demonstrate the example of expm1(double d) // method of Math Classpublic class Expm1Method {public static void main(String[] args) {// Here we are declaring few variablesdouble d1 = 7.0 / 0.0;double d2 = -7.0 / 0.0;double d3 = 0.0;double d4 = -0.0;double d5 = 0.8;double d6 = 2;// Display previous value of d1,d2,d3, d4,d5 and d6 System.out.println(" Before implementing expm1() so the value of d1 is :" + d1);System.out.println(" Before implementing expm1() so the value of d2 is :" + d2);System.out.println(" Before implementing expm1() so the value of d3 is :" + d3);System.out.println(" Before implementing expm1() so the value of d4 is :" + d4);System.out.println(" Before implementing expm1() so the value of d5 is :" + d5);System.out.println(" Before implementing expm1() so the value of d6 is :" + d6);// Here , we will get (Infinity) because we are passing parameter // whose value is (infinity)System.out.println("After implementing expm1() so the value of d1 is :" + Math.expm1(d1));// Here , we will get (-1.0) because we are passing parameter // whose value is (-infinity)System.out.println("After implementing expm1() so the value of d2 is :" + Math.expm1(d2));// Here , we will get (0.0) because we are passing parameter // whose value is (0.0)System.out.println("After implementing expm1() so the value of d3 is :" + Math.expm1(d3));// Here , we will get (-0.0) because we are passing parameter // whose value is (-0.0)System.out.println("After implementing expm1() so the value of d4 is :" + Math.expm1(d4));// Here , we will get [(e raised to the power of 0.8) - 1] // because we are passing parameter whose value is (0.8)System.out.println("After implementing expm1() so the value of d5 is :" + Math.expm1(d5));// Here , we will get [(e raised to the power of 2) - 1] // because we are passing parameter whose value is (2)System.out.println("After implementing expm1() so the value of d6 is :" + Math.expm1(d6));} }Output
輸出量
E:\Programs>javac Expm1Method.javaE:\Programs>java Expm1Method Before implementing expm1() so the value of d1 is :Infinity Before implementing expm1() so the value of d2 is :-Infinity Before implementing expm1() so the value of d3 is :0.0 Before implementing expm1() so the value of d4 is :-0.0 Before implementing expm1() so the value of d5 is :0.8 Before implementing expm1() so the value of d6 is :2.0After implementing expm1() so the value of d1 is :Infinity After implementing expm1() so the value of d2 is :-1.0 After implementing expm1() so the value of d3 is :0.0 After implementing expm1() so the value of d4 is :-0.0 After implementing expm1() so the value of d5 is :1.2255409284924677 After implementing expm1() so the value of d6 is :6.38905609893065翻譯自: https://www.includehelp.com/java/math-class-static-double-expm1-double-d-with-example.aspx
expm1
總結
以上是生活随笔為你收集整理的expm1_Java Math类静态double expm1(double d)及其示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 三位bcd加法计数器_两个8位BCD编号
- 下一篇: python中acosh_带有Pytho