code: public static boolean isEquals(final double x, final double y, final int maxUlps) {
  
          final long xInt = Double.doubleToRawLongBits(x);
          final long yInt = Double.doubleToRawLongBits(y);
  
          final boolean isEqual;
          if (((xInt ^ yInt) & SGN_MASK) == 0L) {
              // number have same sign, there is no risk of overflow
              isEqual = Math.abs(xInt - yInt) <= maxUlps;
          } else {
              // number have opposite signs, take care of overflow
              final long deltaPlus;
              final long deltaMinus;
              if (xInt < yInt) {
                  deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS;
                  deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS;
              } else {
                  deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS;
                  deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS;
              }
  
              if (deltaPlus > maxUlps) {
                  isEqual = false;
              } else {
                  isEqual = deltaMinus <= (maxUlps - deltaPlus);
              }
          }
  
          return isEqual && !Double.isNaN(x) && !Double.isNaN(y);
  
      }
docs: Returns true if both arguments are equal or within the range of allowed
  error (inclusive).
  <p>
  Two float numbers are considered equal if there are {@code (maxUlps - 1)}
  (or fewer) floating point numbers between them, i.e. two adjacent
  floating point numbers are considered equal.
  </p>
  <p>
  Adapted from <a
  href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
  Bruce Dawson</a>
  </p>
  
  @param x       first value
  @param y       second value
  @param maxUlps {@code (maxUlps - 1)} is the number of floating point
  values between {@code x} and {@code y}.
  @return {@code true} if there are fewer than {@code maxUlps} floating
  point values between {@code x} and {@code y}.