code: private static double roundDown(final double n, final int p) {
          double retval;
  
          if (Double.isNaN(n) || Double.isInfinite(n)) {
              retval = Double.NaN;
          } else {
              if (p != 0) {
                  final double temp = Math.pow(10, p);
                  retval = sign(n) * Math.round(Math.abs(n) * temp - ROUNDING_UP_FLOAT) / temp;
              } else {
                  retval = (long) n;
              }
          }
  
          return retval;
      }
docs: Returns a value rounded to p digits after decimal.
  If p is negative, then the number is rounded to
  places to the left of the decimal point. eg.
  10.23 rounded to -1 will give: 10. If p is zero,
  the returned value is rounded to the nearest integral
  value.
  <p>If n is negative, the resulting value is obtained
  as the round-up value of absolute value of n multiplied
  by the sign value of n (@see MathX.sign(double d)).
  Thus, -0.8 rounded-down to p=0 will give 0 not -1.
  <p>If n is NaN, returned value is NaN.
  @param n
  @param p
  @return