Java Utililty Methods Ceil

List of utility methods to do Ceil

  1. HOME
  2. Java
  3. C
  4. Ceil

Description

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

Method

double ceil(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);
double ceil(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;
double ceil(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);
int ceil(double d)
Aufrunden.
int floored = floor(d);
if (d == floored) {
 return floored;
return floored + 1;
int ceil(double d)
ceil
return (int) (d + CEIL) - INT;
double ceil(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;
double ceil(double d, int p)
ceil
long tmp = (long) Math.pow(10, p);
double num = Math.ceil(d * tmp);
num /= tmp;
return num;
long ceil(double double1, double double2)
Ceil function in original algorithm
return (long) (double1 - double2 * Math.floor(double1 / double2));
double ceil(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;
double ceil(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;


AltStyle によって変換されたページ (->オリジナル) /