English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java Base Tutorial

Contrôle de flux Java

Java tableau

Java orienté objet (I)

Java orienté objet (II)

Java orienté objet (III)

Java Exception Handling

Java List

Java Queue (file d'attente)

Java Map

Java Set

Entrée et sortie Java (I/O)

Reader Java/Writer

Autres sujets Java

Utilisation et exemple de la méthode Math.exp() de Java

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.

exp() parameter

  • a - To increase the number to the power of e

exp() return value

  • Returns the parameter power of the natural number base e, that isea

Note: Here, e is Euler's number, whose value is2.71828

Example: Java Math.exp()

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

Java Math mathematical methods