Java tutorial
//package com.java2s; public class Main { /** * Returns next bigger double value considering precision of the argument. * */ public static double nextUp(double d) { if (Double.isNaN(d) || d == Double.POSITIVE_INFINITY) { return d; } else { d += 0.0; return Double.longBitsToDouble(Double.doubleToRawLongBits(d) + ((d >= 0.0) ? +1 : -1)); } } }