DfFloatRangeType (float from, float to, boolean exact) { if (Float.compare(from, to) > 0) return this; if (myInvert) { if (Float.compare(to, myFrom) < 0 || Float.compare(from, myTo) > 0) return this; int fromCmp = Float.compare(myFrom, from); int toCmp = Float.compare(to, myTo); if (fromCmp >= 0 && toCmp >= 0 || fromCmp < 0 && toCmp < 0) { return exact ? null : (DfFloatRangeType)create(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, false, myNaN); } if (fromCmp >= 0) { return (DfFloatRangeType)create(nextUp(to), myTo, true, myNaN); } return (DfFloatRangeType)create(myFrom, nextDown(from), true, myNaN); } else { if (Float.compare(myTo, nextDown(from)) < 0 || Float.compare(to, nextDown(myFrom)) < 0) { if (myFrom == Float.NEGATIVE_INFINITY && to == Float.POSITIVE_INFINITY) { return (DfFloatRangeType)create(nextUp(myTo), nextDown(from), true, myNaN); } if (exact) return null; } return (DfFloatRangeType)create(Math.min(myFrom, from), Math.max(myTo, to), false, myNaN); } }