List of utility methods to do Double Number Round
double | round(double d) round return Math.round(d * 100D) / 100D;
|
double | round(double d) Rounds the number to 4 significant digits if (d == 0.0) return d; int digits = (int) (Math.log(d) / Math.log(10)); return round(d, 3 - digits); |
int | round(double d) Round a double int i = (int) d; double result = d - i; if (result < 0.5D) return i; return i + 1; |
int | round(double d) round return floor(d + 0.5d);
|
int | round(double d) round return (int) Math.round(d); |
long | round(double d) round if (d < 0) { return (long) (d - 0.5); } else { return (long) (d + 0.5); |
int | round(double d) Unchecked implementation to round a number. return (int) (d + 0.5D); |
int | round(double d) Round. return (int) Math.round(d); |
double | round(double d, int decimalPlacesRequired) Reduces the precision of a double to a specified number of decimal places. double factor = Math.pow(10, decimalPlacesRequired); return Math.round((d * factor)) / factor; |
double | round(double d, int decimals) round if (d != d) { return Double.NaN; double n = Math.pow(10, decimals); return Math.round(d * n) / n; |