Wednesday, 15 February 2017

Math : NextAfterMethod




public class NextAfterMethod {

    public static void main(String[] args) {

        // get two double numbers        double x = 98759.765;        double y = 154.28764;
        // print the next number for x towards y        System.out.println("Math.nextAfter(" + x + "," + y + ")="                + Math.nextAfter(x, y));
        // print the next number for y towards x        System.out.println("Math.nextAfter(" + y + "," + x + ")="                + Math.nextAfter(y, x));    }
}

No comments:

Post a Comment