public static double bround(double d) {
    long intPart = (long) (d);
    if (d > 0.0) {
      if (d - intPart == 0.5d) {
        if (intPart % 2 == 0) {
          return intPart;
        }
        return intPart + 1;
      }
      return (double) ((long) (d + 0.5d));
    } else {
      if (intPart - d == 0.5d) {
        if (intPart % 2 == 0) {
          return intPart;
        }
        return intPart - 1;
      }
      return (double) ((long) (d - 0.5d));
    }
  }
Math expression evaluation helper functions.
Some of these are referenced from ColumnUnaryFunc.txt.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/MathExpr.java