Java Ceil ceil(double a, double precision)

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

Description

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

License

Open Source License

Parameter

Parameter Description
a Value
precision Precision

Return

Rounded value

Declaration

public static double ceil(double a, double precision) 

Method Source Code

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

public class Main {
    /**//from  ww  w  .ja va2s . com
     * Returns a rounded number larger than {@code a} with a defined
     * precision.
     *
     * @param a         Value
     * @param precision Precision
     * @return Rounded value
     */
    public static double ceil(double a, double precision) {
        if (precision == 0.0) {
            return 0.0;
        }
        return Math.ceil(a / precision) * precision;
    }
}

Related

  1. ceil(double a)
  2. ceil(double a, int cutOfDigits)
  3. ceil(double d)
  4. ceil(double d)
  5. ceil(double d, int exp)