Java Utililty Methods Double Number Round

List of utility methods to do Double Number Round

Description

The list of methods to do Double Number Round are organized into topic(s).

Method

doubleroundDecimal(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;
doubleroundDecimals(double d, int decimalPlaces)
round Decimals
int j = (int) (d * Math.pow(10, decimalPlaces));
return j / Math.pow(10, decimalPlaces);
doubleroundDecimals(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);
introundDiv(double a, double b)
Dividieren und dann das Ergebnis runden.
return round(a / b);
doubleroundDouble(double d)
round Double
int c = 10;
int temp = (int) ((d * Math.pow(10, c)));
return (((double) temp) / Math.pow(10, c));
doubleroundDouble(double d)
round Double
return (double) (int) d;
doubleroundDouble(double d, int decimals)
round Double
long tempD = (long) (d * Math.pow(10, decimals));
return tempD / (Math.pow(10, decimals));
StringroundDouble(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);
...
doubleroundDouble(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);
doubleroundDouble(double num, int precision)
round Double
return ((double) Math.round(num * pow(10, precision))) / (pow(10, precision));