DfType (double from, double to, boolean invert, boolean nan) { assert !Double.isNaN(from); assert !Double.isNaN(to); if (Double.compare(from, to) > 0) { return nan ? new DfDoubleConstantType(Double.NaN) : DfType.BOTTOM; } if (to == Double.POSITIVE_INFINITY && from == Double.NEGATIVE_INFINITY) { if (invert) { return nan ? new DfDoubleConstantType(Double.NaN) : DfType.BOTTOM; } return new DfDoubleRangeType(from, to, false, nan); } if (to == Double.POSITIVE_INFINITY) { to = nextDown(from); from = Double.NEGATIVE_INFINITY; invert = !invert; } if (!nan && !invert && Double.compare(from, to) == 0) { return new DfDoubleConstantType(from); } if (!nan && invert && from == Double.NEGATIVE_INFINITY && to == nextDown(Double.POSITIVE_INFINITY)) { return new DfDoubleConstantType(Double.POSITIVE_INFINITY); } return new DfDoubleRangeType(from, to, invert, nan); }