Wednesday, 15 February 2017

Math : log




public class LogMethod {
    public static void main(String[] args) {

        // get two double numbers        double x = 60984.1;        double y = -497.99;
        // get the natural logarithm for x        System.out.println("Math.log(" + x + ")=" + Math.log(x));
        // get the natural logarithm for y        System.out.println("Math.log(" + y + ")=" + Math.log(y));
        // ---log10
        // get two double numbers        double x1 = 60984.1;        double y1 = 1000;
        // get the base 10 logarithm for x        System.out.println("Math.log10(" + x1 + ")=" + Math.log10(x1));
        // get the base 10 logarithm for y        System.out.println("Math.log10(" + y1 + ")=" + Math.log10(y1));
        // ---log1p        // get two double numbers        double x2 = 60984.1;        double y2 = 1000;
        // call log1p and print the result        System.out.println("Math.log1p(" + x2 + ")=" + Math.log1p(x2));
        // call log1p and print the result        System.out.println("Math.log1p(" + y2 + ")=" + Math.log1p(y2));    }
}

No comments:

Post a Comment