According to the Javadoc:
public static double nextAfter(double start, double direction)...
- If start is equal to ± Double.MAX_VALUE and direction has a value such that the result should have a larger magnitude, an infinity with same sign as start is returned.
But according to this example:
System.out.println(Double.MAX_VALUE);
System.out.println(Math.nextAfter(Double.MAX_VALUE, 1));
System.out.println(Math.nextAfter(Double.MAX_VALUE, 1) == Double.POSITIVE_INFINITY);
Output:
1.7976931348623157E308
1.7976931348623155E308
false
Eh? Not only is it not Double.POSITIVE_INFINITY, it's actually smaller in magnitude.
...157E308
...155E308
Am I just completely misreading the Javadoc?