code: public static double ceil(double x) {
          double y;
  
          if (x != x) { // NaN
              return x;
          }
  
          y = floor(x);
          if (y == x) {
              return y;
          }
  
          y += 1.0;
  
          if (y == 0) {
              return x*y;
          }
  
          return y;
      }
docs: Get the smallest whole number larger than x.
  @param x number from which ceil is requested
  @return a double number c such that c is an integer c - 1.0 < x <= c