English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java Math mathematical methods
La méthode Math.exp() de Java est utilisée pour retourner la puissance du nombre naturel e.
C'est-à-dire, Math.exp(4.0) = e4.0
La syntaxe de la méthode exp() est :
Math.exp(double a)
Note: The exp() method is a static method. Therefore, we can use the class name Math to directly call this method.
a - To increase the number to the power of e
Returns the parameter power of the natural number base e, that isea
Note: Here, e is Euler's number, whose value is2.71828
class Main { public static void main(String[] args) { // Math.exp() method double a = 4.0d; System.out.println(Math.exp(a)); // 54.598150033144236 //Without using Math.exp() //The value of Euler's number double euler = 2.71828d; System.out.println(Math.pow(euler, a)); // 54.5980031309658 } }
In the above example, we usedMath.pow()method to calculate e 4.0Value. Here, we can see
Math.exp(4.0) = e4.0