public static double RoundHalfUp(double d) { return .5 * Math.ceil(d / .5); // BigDecimal value = new BigDecimal(d); // value.setScale(1, RoundingMode.HALF_UP); // return value.doubleValue(); }
/** * * Adds .5 and rounds the result...this should round up to the full integer anything <.4 * * @param d Value to round up to the next full integer * @return rounded integer */ public static double RoundFullUp(double d) { return Math.round(.4 + d); }