code: public static double floor(double x) {
          long y;
  
          if (x != x) { // NaN
              return x;
          }
  
          if (x >= TWO_POWER_52 || x <= -TWO_POWER_52) {
              return x;
          }
  
          y = (long) x;
          if (x < 0 && y != x) {
              y--;
          }
  
          if (y == 0) {
              return x*y;
          }
  
          return y;
      }
docs: Get the largest whole number smaller than x.
  @param x number from which floor is requested
  @return a double number f such that f is an integer f <= x < f + 1.0