@Override
  public @NotNull DfType castTo(@NotNull PsiPrimitiveType type) {
    if (type.equals(PsiTypes.longType())) {
      LongRangeSet range;
      if (!myInvert) {
        range = LongRangeSet.range((long)myFrom, (long)myTo);
      } else {
        range = LongRangeSet.empty();
        if (myFrom > Double.NEGATIVE_INFINITY) {
          range = range.join(LongRangeSet.range(Long.MIN_VALUE, (long)nextDown(myFrom)));
        }
        if (myTo < Double.POSITIVE_INFINITY) {
          range = range.join(LongRangeSet.range((long)nextUp(myTo), Long.MAX_VALUE));
        }
      }
      if (myNaN) {
        range = range.join(LongRangeSet.point(0));
      }
      return DfTypes.longRange(range);
    }
    if (type.equals(PsiTypes.intType()) || type.equals(PsiTypes.shortType()) || type.equals(PsiTypes.byteType()) || type.equals(PsiTypes.charType())) {
      LongRangeSet range;
      if (!myInvert) {
        range = LongRangeSet.range((int)myFrom, (int)myTo);
      } else {
        range = LongRangeSet.empty();
        if (myFrom > Double.NEGATIVE_INFINITY) {
          range = range.join(LongRangeSet.range(Integer.MIN_VALUE, (int)nextDown(myFrom)));
        }
        if (myTo < Double.POSITIVE_INFINITY) {
          range = range.join(LongRangeSet.range((int)nextUp(myTo), Integer.MAX_VALUE));
        }
      }
      if (myNaN) {
        range = range.join(LongRangeSet.point(0));
      }
      DfType result = DfTypes.intRange(range);
      if (result instanceof DfPrimitiveType && !type.equals(PsiTypes.intType())) {
        return ((DfPrimitiveType)result).castTo(type);
      }
      return result;
    }
    if (type.equals(PsiTypes.doubleType())) {
      return this;
    }
    return DfType.TOP;
  }
@Override
  public @NotNull DfType castTo(@NotNull PsiPrimitiveType type)