List of utility methods to do floor
double | floor(double num, int bit) floor int t = 1; for (int i = 0; i < bit; i++) t *= 10; int n = (int) (num * t); return (double) n / t; |
double | floor(double number, int decimals) Returns the floor number to the given decimal places. double pow = number * Math.pow(10, decimals); double floor = Math.floor(pow); double value = floor / Math.pow(10, decimals); return value; |
double | floor(double value, int decimal) Rounds the passed value to the specified number of decimals. if (decimal <= 0) return value; double p = Math.pow(10, decimal); value = value * p; return Math.floor(value) / p; |
double | floor(double value, int scale) Floor. double power = Math.pow(10, scale); return Math.floor(value * power) / power; |
int | floor(double var0) floor int var2 = (int) var0; return var0 < (double) var2 ? var2 - 1 : var2; |
int | floor(double x) floor int y = (int) x; if (x < y) { return y - 1; return y; |
int | floor(double x) Rounds x down to the closest integer int y = (int) x; if (x < y) { return y - 1; return y; |
int | floor(double x) A fast implementation of Math#floor(double) . return (int) (x + BIG_ENOUGH_FLOOR) - BIG_ENOUGH_INT; |
double | floor(double x, double y) Truncate x down to the nearest y. return y * Math.floor((x + .00001) / y);
|
double[] | floor(double[] array) Rounds down each element of a given double array. double[] out = new double[array.length]; for (int i = 0; i < array.length; i++) out[i] = Math.floor(array[i]); return out; |