提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
双精度型值的数学计算
public class ExponentialDemo { public static void main(String[] args) {// 来自 时 代 Java 公 众 号 - nowjava.com 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)); System.out.printf("log(%.3f) is " + "%.3f%n", x, Math.log(x)); System.out.printf("pow(%.3f, %.3f) " + "is %.3f%n", x, y, Math.pow(x, y)); System.out.printf("sqrt(%.3f) is " + "%.3f%n", x, Math.sqrt(x)); } } /** 来自 n o w j a v a . c o m**/