List of utility methods to do Double Number Round
int | round_double(double d) roundouble return (int) Math.round(d); |
Double | round_nearestmultipleof5(double value) rounnearestmultipleof if (value % 5 == 0) { return value; } else if (value % 5 < 2.5) { return value - value % 5; } else { return value + (5 - value % 5); |
double | roundAndScale(double startValue, int places) round And Scale double multiplier = calculateMultiplier(places); double ourNoughtPointFive = 0.50000000001; double absoluteValue = Math.abs(startValue); double valueToBeFloored = (absoluteValue * multiplier) + ourNoughtPointFive; double roundedValue = Math.floor(valueToBeFloored); double returnValue = roundedValue / multiplier; if (startValue < 0) returnValue = -returnValue; ... |
double | roundAngle(double a, long n) round Angle return Math.round(a * n) / n;
|
double | roundAtDecimals(double number, int deci) round At Decimals int decimal = deci * 10; number = number * decimal; Math.round(number); return number / decimal; |
int | roundAway(double d) round Away return (int) (d < 0 ? Math.floor(d) : Math.ceil(d)); |
double | roundAwayFromZero(double num) round Away From Zero if (num >= 0.0) return (Math.round(num + 0.49999999999999)); else return (Math.round(num - 0.49999999999999)); |
double | roundBig(double d) round Big long i = (long) d; d -= i; return i + (d >= 0.5 ? 1 : (d <= -0.5 ? -1 : 0)); |
float | roundDec(float num, int dec) round Dec return (float) Math.round(num * (10 ^ dec)) / (10 ^ dec); |
Double | roundDecimal(Double value) round Decimal return roundDecimal(value, DEFAULT_DECIMALS);
|