java オイラーの数の累乗を取得する

java オイラーの数の累乗を取得する

javaで、オイラーの数の累乗を取得する手順を記述してます。

環境

  • OS windows11 home
  • java 17.0.2

手順

オイラーの数の累乗を取得するには、「Math.exp」で可能です。

Math.exp(数値)

実際に、使用してみます。

public class App {
    public static void main(String[] args) throws Exception {

        System.out.println(Math.exp(1)); // 2.718281828459045
        System.out.println(Math.exp(2)); // 7.38905609893065
        System.out.println(Math.exp(0)); // 1.0

    }
}

取得されていることが確認できます。