Java Ceil ceil2(double d, int p)

Here you can find the source of ceil2(double d, int p)

Description

ceil

License

Apache License

Declaration

public static double ceil2(double d, int p) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static double ceil2(double d, int p) {
        long tmp = (long) Math.pow(10, p);
        double num = Math.ceil(d / tmp);
        num *= tmp;/*from  w w  w. jav a  2s .  c  o m*/
        return num;
    }

    public static double ceil(double d, int p) {
        long tmp = (long) Math.pow(10, p);
        double num = Math.ceil(d * tmp);
        num /= tmp;
        return num;
    }
}

Related

  1. ceil(int x, int quantum)
  2. ceil(long a, long b)
  3. Ceil(Object in, int val)
  4. ceil(Short a)
  5. ceil10(double a)
  6. ceil2(int a, int preserveDigits)
  7. ceilDiv(int numerator, int denominator)
  8. ceilDiv(int v1, int v2)
  9. ceilDiv(long a, long b)