List of utility methods to do Double Number Round
double | roundDouble(double number, int precision) Returns the rounded double number with a given precision. int temp = (int) ((number * Math.pow(10, precision))); return (((double) temp) / Math.pow(10, precision)); |
double | roundDouble(double pDouble, int pPlaces) round Double return Math.round(pDouble * Math.pow(10, (double) pPlaces)) / Math.pow(10, (double) pPlaces); |
Double | roundDouble(double val, int precision) roundDouble. double factor = Math.pow(10, precision); return Math.floor(val * factor + 0.5) / factor; |
double | roundDouble(double value) This method takes double value as a parameter and rounds it to two decimal points and returns the rounded value. int decimalPlace = 2; double power_of_ten = 1; while (decimalPlace-- > 0) { power_of_ten *= 10.0; return Math.round(value * power_of_ten) / power_of_ten; |
double | roundDouble(double value, int afterDecimalPoint) Rounds a double to the given number of decimal places. double mask = Math.pow(10.0, (double) afterDecimalPoint); return (double) (Math.round(value * mask)) / mask; |
double | roundDouble3(double r) round Double return roundDouble(r, 3);
|
double | roundDoubleDownTo(double value, double steps) round Double Down To if (steps == 0) { return value; } else { return Math.floor(value / steps) * steps; |
double | roundDoubleNicely(double intensity) round Double Nicely return Math.round(intensity * 10000f) / 10000f;
|
double | roundDoubleTo(double val, int pow) Function to round off a double value upto a specific decimal place. double p = (double) Math.pow(10, pow); val = val * p; double tmp = (double) (Math.round(val)); return (Double) tmp / p; |
int | roundDoubleToInt(final double VALUE) round Double To Int double dAbs = Math.abs(VALUE); int i = (int) dAbs; double result = dAbs - (double) i; if (result < 0.5) { return VALUE < 0 ? -i : i; } else { return VALUE < 0 ? -(i + 1) : i + 1; |