Here you can find the source of roundAwayFromZero(double num)
public static double roundAwayFromZero(double num)
//package com.java2s; /** This class is a PanelLeft factory, creating all panels based on the * contents of the panels.xml file./* ww w . j a v a 2 s.c om*/ * * Last Updated: May 25, 2011 * * by Rick C. Hodgin * Cossatot Analytics Laboratories, LLC. (Cana Labs) * * (c) Copyright Cana Labs. * Free software licensed under the GNU GPL2. * * @author Rick C. Hodgin * @version 1.0.0 * * Change history: * 2011-05-25 - 1.0.0 - Initial release * */ public class Main { public static double roundAwayFromZero(double num) { if (num >= 0.0) return (Math.round(num + 0.49999999999999)); // Normal positive rounding else return (Math.round(num - 0.49999999999999)); // Negative rounding } }