Java 教程
exp() 方法用于返回自然數(shù)底數(shù)e的參數(shù)次方。
該方法有以下幾種語法格式:
double exp(double d)
d -- 任何原生數(shù)據(jù)類型。
返回自然數(shù)底數(shù)e的參數(shù)次方。
public class Test{ ????public static void main(String args[]){ ????????double x = 11.635; ????????double y = 2.76; ????????System.out.printf("e 的值為 %.4f%n", Math.E); ????????System.out.printf("exp(%.3f) 為 %.3f%n", x, Math.exp(x)); ????} }
編譯以上程序,輸出結(jié)果為:
e 的值為 2.7183 exp(11.635) 為 112983.831