集册 Java实例教程 双精度型值的数学计算

双精度型值的数学计算

欢马劈雪     最近更新时间:2020-01-02 10:19:05

570
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
双精度型值的数学计算

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**/

展开阅读全文