List of utility methods to do Number Round
int | roundBytesUpToWords(int bytes) round Bytes Up To Words return (bytes + 7) / 8;
|
long | roundChipRewardDown(long chips) round Chip Reward Down if (chips < 1000) return chips; int digits = ((int) Math.floor(Math.log(chips) / LOG_10)) + 1; double divider = Math.pow(10, (digits - 1)); chips = (long) (Math.floor(chips / divider) * divider); return chips; |
String | roundCss(double v, int n) round Css return String.valueOf(Math.round(v * e[n]) / e[n]);
|
double | rounded(double value, int places, int ceilOrFloor) Method responsible for rounded numerical values (double) double arredondado = value; arredondado *= (Math.pow(10, places)); if (ceilOrFloor == 0) { arredondado = Math.ceil(arredondado); } else { arredondado = Math.floor(arredondado); arredondado /= (Math.pow(10, places)); ... |
long | ROUNDED_DIV(long a, long b) ROUNDEDIV return ((a > 0 ? a + (b >> 1) : a - (b >> 1)) / b);
|
long | rounded_shift_down(long x, int n) roundeshifdown if (n == 0) return (x); else { return ((x >> (n - 1)) >> 1); |
double | roundedApply(double value, double percent, double delta) Applies the value with percent and rounds the result if its in space of the delta. double correct = Math.round(value * (1 + percent) * 100.0) / 100.0; double rounded = Math.round(correct); if (Math.abs(rounded - correct) < delta) return rounded; return correct; |
String | roundedDollarValue(double d) rounded Dollar Value return numberValue(Math.round(d));
|
double | roundedLog(double value, double exponent) a rounded logarithm to avoid issues with jvm dependant math functions return Math.round(log(value, exponent) * ROUNDED_LOG_PRECISION) / ROUNDED_LOG_PRECISION;
|
int | roundedLog10(int n) rounded Log int j = 0; int p = 1; while (p < n) { p *= 10; j++; return j; |