List of utility methods to do Double Number Round
double | roundDecimal(double x, int d) Rounds the number off to a given number of significant digits. if ((d > 0) && (x != 0)) { double factor = Math.pow(10, Math.floor(log10(Math.abs(x))) - d + 1); x = Math.rint(x / factor) * factor; return x; |
double | roundDecimals(double d, int decimalPlaces) round Decimals int j = (int) (d * Math.pow(10, decimalPlaces)); return j / Math.pow(10, decimalPlaces); |
double | roundDecimals(double x, int decimals) Rounds a double to specified number of decimal places. if (decimals > 9) return (Math.ceil(x * decimals) / decimals); double z = 1; for (int i = 1; i <= decimals; i++) z *= 10; return (Math.ceil(x * z) / z); |
int | roundDiv(double a, double b) Dividieren und dann das Ergebnis runden. return round(a / b);
|
double | roundDouble(double d) round Double int c = 10; int temp = (int) ((d * Math.pow(10, c))); return (((double) temp) / Math.pow(10, c)); |
double | roundDouble(double d) round Double return (double) (int) d; |
double | roundDouble(double d, int decimals) round Double long tempD = (long) (d * Math.pow(10, decimals)); return tempD / (Math.pow(10, decimals)); |
String | roundDouble(double d, int place) round Double if (place <= 0) return String.valueOf((int) (d + ((d > 0) ? 0.5 : -0.5))); String s = ""; if (d < 0) { s += "-"; d = -d; d += 0.5 * Math.pow(10, -place); ... |
double | roundDouble(double d, int places) Rounds a double to a set number of decimal places return Math.round(d * Math.pow(10, (double) places)) / Math.pow(10, (double) places); |
double | roundDouble(double num, int precision) round Double return ((double) Math.round(num * pow(10, precision))) / (pow(10, precision)); |