English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java Math Mathematical Methods
O método Math.exp() da Java é usado para retornar a potência do número natural e como base.
Isso significa que Math.exp(4.0) = e4.0
A sintaxe do método exp() é:
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()Methods to calculate e 4.0Value. Here, we can see
Math.exp(4.0) = e4.0