List of utility methods to do Double Number Round
double | round(double val, long dec) round double erg, p; p = Math.pow(10.0, (double) dec); erg = Math.floor(val * p + 0.5) / p; return erg; |
int | round(double valor) DOCUMENT ME! if ((valor - ((int) valor)) >= 0.5) return (((int) valor) + 1); else if ((int) valor == 0) return 1; else return (int) valor; |
int | round(double value) round int roundedValue = value > 0 ? (int) (value + 0.5) : -(int) (Math.abs(value) + 0.5); return roundedValue; |
double | round(double value) round return Math.round(value * 10000) / 10000.0;
|
int | round(double value) Rounds a double to the next nearest integer value. int roundedValue = value > 0 ? (int) (value + 0.5) : -(int) (Math.abs(value) + 0.5); return roundedValue; |
long | round(double value) Rounds the given double value if (value < 0) { return (long) (value - 0.5); } else { return (long) (value + 0.5); |
long | round(double value) Rounds the given double value if (value < 0) { return (long) (value - 0.5); } else { return (long) (value + 0.5); |
double | round(double value) round final double NUMBER_OF_DIGITS = 1E5; return (double) Math.round(value * NUMBER_OF_DIGITS) / NUMBER_OF_DIGITS; |
String | round(double value, double decimalplaces) Rounds value. double mult = Math.pow(10.0, decimalplaces); return String.valueOf(Math.round(value * mult) / mult); |
double | round(double value, double factor) Round the value to the nearest factor. return (Math.round(value / factor) * factor);
|