Java floor floor(double a, double precision)

Here you can find the source of floor(double a, double precision)

Description

Returns a rounded number smaller than a with a defined precision.

License

Open Source License

Parameter

Parameter Description
a Value
precision Precision

Return

Rounded value

Declaration

public static double floor(double a, double precision) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//ww w.  j a v a  2  s  .  com
     * Returns a rounded number smaller than {@code a} with a defined
     * precision.
     *
     * @param a         Value
     * @param precision Precision
     * @return Rounded value
     */
    public static double floor(double a, double precision) {
        if (precision == 0.0) {
            return 0.0;
        }
        return Math.floor(a / precision) * precision;
    }
}

Related

  1. floor(double a)
  2. floor(double a, int cutOfDigits)
  3. floor(double a, int n)
  4. floor(double d)
  5. floor(double d)