Java Utililty Methods floor

List of utility methods to do floor

  1. HOME
  2. Java
  3. f
  4. floor

Description

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

Method

double floor(double a)
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
return Math.floor(a);
double floor(double a, double precision)
Returns a rounded number smaller than a with a defined precision.
if (precision == 0.0) {
 return 0.0;
return Math.floor(a / precision) * precision;
double floor(double a, int cutOfDigits)
Modification of Math#floor(double) taking an additional argument representing the requested accuracy in the following way:
double fac = Math.pow(10, digits);
return fac * Math.floor(a / fac);
double fac = Math.pow(10, cutOfDigits);
return fac * Math.floor(a / fac);
double floor(double a, int n)
floor
double p = Math.pow(10.0, n);
return Math.floor((a * p) + 0.5) / p;
int floor(double d)
floor
return (int) (d + FLOOR) - INT;
int floor(double d)
floor
return (int) Math.floor(d);
int floor(double d)
Unchecked implementation to round a number down.
int i = (int) d;
return d < i ? i - 1 : i;
double floor(double d, int exp)
This method returns the largest double value that is smaller than d = x * 10exp where x is rounded down to the closest integer.
double x = 1.0 * Math.pow(10.0, (double) exp);
return Math.floor(d / x) * x;
double floor(double d, int p)
floor
long tmp = (long) Math.pow(10, p);
double num = Math.floor(d * tmp);
num /= tmp;
return num;
int floor(double num)
floor
final int numInt = (int) num;
return numInt == num ? numInt : numInt - (int) (Double.doubleToRawLongBits(num) >>> 63);


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