List of utility methods to do Double Number Round
double | round(double d, int i) round long powerTen = 1; for (int x = 0; x < i; x++) { powerTen *= 10; return ((double) Math.round(d * powerTen)) / powerTen; |
double | round(double d, int numDecimal) Round specified value to specified number of decimal. final double pow = Math.pow(10, numDecimal); return Math.round(d * pow) / pow; |
double | round(double d, int p) round long tmp = (long) Math.pow(10, p); double num = Math.round(d * tmp); num /= tmp; return num; |
double | round(double d, int precision) round int temp = (int) ((d * Math.pow(10, precision))); return (((double) temp) / Math.pow(10, precision)); |
float | Round(double d, int Rpl) rounds a number to RPL places float p = (float) Math.pow(10, Rpl); d = d * p; float tmp = Math.round(d); return (float) tmp / p; |
double | round(double dValue) round return Math.rint(dValue * m_dFractionMultiplier) / m_dFractionMultiplier;
|
double | round(double input) A quick way to round numbers. input = input * 1000.0; int tempInt = (int) input; double output = ((double) tempInt) / 1000; return output; |
double | round(double input, double step) Method rounds input number by a specific step return ((Math.round(input / step)) * step);
|
int | round(double n) Round to the nearest integer. This is different from Math.round() for negative number. return (int) ((n > 0 ? 0.5 : -0.5) + n); |
double | round(double n, double nd) round if (isFinite(n) && isFinite(nd)) { double sign_n = (n < 0) ? -1 : 1; double abs_n = Math.abs(n); double factor = Math.pow(10, nd); return sign_n * Math.round(abs_n * factor) / factor; } else { return Double.NaN; |