該方法返回自然對數(shù)e的底數(shù)為參數(shù)的冪。
double exp(double d)
d - 任何原始數(shù)據(jù)類型。
此方法返回自然對數(shù)的底,e,為參數(shù)的冪。
下面是一個使用這個方法的例子 -
class Example { static void main(String[] args) { double x = 11.635; double y = 2.76; System.out.printf("The value of e is %.4f%n", Math.E); System.out.printf("exp(%.3f) is %.3f%n", x, Math.exp(x)); } }
當(dāng)我們運行上面的程序,我們將得到以下結(jié)果 -
The value of e is 2.7183 exp(11.635) is 112983.831
更多建議: