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

Tutorial Básico de Java

Controle de fluxo do Java

Array do Java

Java orientado a objetos (I)

Java orientado a objetos (II)

Java orientado a objetos (III)

Tratamento de Exceção Java

Lista do Java (List)

Java Queue (Fila)

Conjunto Map do Java

Conjunto Set do Java

Entrada e saída do Java (I/O)

Reader do Java/Writer

Outros tópicos do Java

Uso e exemplo do método Math.exp() da Java

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.

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()Methods to calculate e 4.0Value. Here, we can see

Math.exp(4.0) = e4.0

Java Math Mathematical Methods