Java Utililty Methods Ceil

List of utility methods to do Ceil

Description

The list of methods to do Ceil are organized into topic(s).

Method

doubleceil(double a)
Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
return Math.ceil(a);
doubleceil(double a, double precision)
Returns a rounded number larger than a with a defined precision.
if (precision == 0.0) {
    return 0.0;
return Math.ceil(a / precision) * precision;
doubleceil(double a, int cutOfDigits)
Modification of Math#ceil(double) taking an additional argument representing the requested accuracy in the following way:
double fac = Math.pow(10, digits);
return fac * Math.ceil(a / fac);
double fac = Math.pow(10, cutOfDigits);
return fac * Math.ceil(a / fac);
intceil(double d)
Aufrunden.
int floored = floor(d);
if (d == floored) {
    return floored;
return floored + 1;
intceil(double d)
ceil
return (int) (d + CEIL) - INT;
doubleceil(double d, int exp)
This method returns the smallest double value that is smaller than d = x * 10exp where x is rounded up to the closest integer.
double x = 1.0 * Math.pow(10.0, (double) exp);
return Math.ceil(d / x) * x;
doubleceil(double d, int p)
ceil
long tmp = (long) Math.pow(10, p);
double num = Math.ceil(d * tmp);
num /= tmp;
return num;
longceil(double double1, double double2)
Ceil function in original algorithm
return (long) (double1 - double2 * Math.floor(double1 / double2));
doubleceil(double num, int bit)
ceil
int t = 1;
for (int i = 0; i < bit; i++)
    t *= 10;
int n = (int) (num * t) + 1;
return (double) n / t;
doubleceil(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.ceil(value) / p;