List of utility methods to do floor
int | floorDiv(int dividend, int divisor) Computes the floored division dividend/divisor which is useful when dividing potentially negative numbers into bins.
return ((dividend >= 0) ? dividend : (dividend - divisor + 1)) / divisor;
|
int | floorDiv(int v1, int v2) floor Div return v1 / v2 - (((v1 % v2 != 0) && negativeProduct(v1, v2)) ? 1 : 0);
|
long | floorDiv(long a, long b) Returns the floor division. return (a >= 0 ? a / b : ((a + 1) / b) - 1);
|
long | floorDiv(long x, long y) Divide, rounding towards negative infinity. long r = x / y; if ((x ^ y) < 0 && (r * y != x)) { r--; return r; |
int | floorDivide(int value, int divisor) Returns the largest lower limit of quotient. {@code floorDivide(1, 2) == 0}</li> * <li>{@code floorDivide(0, 2) == 0}</li> * <li>{@code floorDivide(-1, 2) == -1}</li> * <li>{@code floorDivide(-2, 2) == -1}</li> * <li>{@code floorDivide(-3, 2) == -2}</li> * </ul> * * @param value numerator * @param divisor divisor ... |
long | floorDivide(long n, long d) floor Divide return ((n >= 0) ? (n / d) : (((n + 1L) / d) - 1L));
|
long | floorDivide(long numerator, long denominator) Divide two long integers, returning the floor of the quotient. return (numerator >= 0) ? (numerator / denominator) : (((numerator + 1) / denominator) - 1);
|
int | floorDivision(int i, int divisor) floor Division return floor(((float) i) / divisor); |
int | floorHalf(int num) Returns the floor of the half of the input value if ((num & 1) == 1) { return (num - 1) / 2; } else { return num / 2; |
Double | floorInt(Double d, double intv) floor Int if (d < 0) { d -= intv * 0.9999999; d = d / intv; d = d < 0 ? Math.ceil(d - 0.0000000000001) : Math.floor(d + 0.0000000000001); return d * intv; |