code: @SuppressWarnings("unchecked")
      public static int compare(Comparable lhs, Comparable rhs) {
          Class lhsClass = lhs.getClass();
          Class rhsClass = rhs.getClass();
          assert lhsClass != rhsClass;
          assert lhs instanceof Number;
          assert rhs instanceof Number;
  
          Number lhsNumber = (Number) lhs;
          Number rhsNumber = (Number) rhs;
  
          if (isDoubleRepresentable(lhsClass)) {
              if (isDoubleRepresentable(rhsClass)) {
                  return Double.compare(lhsNumber.doubleValue(), rhsNumber.doubleValue());
              } else if (isLongRepresentable(rhsClass)) {
                  return -Integer.signum(compareLongWithDouble(rhsNumber.longValue(), lhsNumber.doubleValue()));
              }
          } else if (isLongRepresentable(lhsClass)) {
              if (isDoubleRepresentable(rhsClass)) {
                  return compareLongWithDouble(lhsNumber.longValue(), rhsNumber.doubleValue());
              } else if (isLongRepresentable(rhsClass)) {
                  return compareLongs(lhsNumber.longValue(), rhsNumber.longValue());
              }
          }
  
          return lhs.compareTo(rhs);
      }
docs: Compares the provided {@link Number} instances.
  <p>
  The method accepts {@link Comparable} instances because to compare
  something it must be comparable, but {@link Number} is not comparable.
  <p>
  Special numeric comparison logic is used for {@link Double}, {@link Long},
  {@link Float}, {@link Integer}, {@link Short} and {@link Byte}:
  comparison is performed by taking into account only the magnitudes and
  signs of the passed numbers, disregarding the actual underlying types.
  
  @param lhs the left-hand side {@link Number}. Can't be {@code null}.
  @param rhs the right-hand side {@link Number}. Can't be {@code null}.
  @return a negative integer, zero, or a positive integer as the left-hand
  side {@link Number} is less than, equal to, or greater than the
  right-hand side {@link Number}.