@@ -2410,8 +2410,25 @@ exports.Interval = Interval;
24102410// - high open boundary that is uncertainty from min value of type or interval low value to max
24112411// value of type is changed to null open boundary
24122412//
2413- // TODO: Is this necessary? Do we care how it is represented if the representations have the same
2414- // meaning? This does affect test expectations and representation of returned results for callers.
2413+ // Justification: Since interval operations now use start() and end() to calculate and construct
2414+ // intervals, results involving unbounded lows and highs will return boundaries with concrete
2415+ // minimum and maximum values instead of the more familiar closed null boundary representations.
2416+ // Similarly, results involving unknown lows and highs will return boundaries with uncertainty
2417+ // ranges rather than the more familiar open null boundary representations. In other words,
2418+ // intervals that started out looking "simple", such as Interval[null, 0], can result in new
2419+ // intervals with specific values that are not obvious to users, such as Interval[-2147483648, 0].
2420+ //
2421+ // The normalizeInterval function recognizes those situations and converts the interval back to an
2422+ // equivalent form that is more likely to be familiar to all users. The results of this approach
2423+ // are also more consistent with previous implementations that did not use start() and end().
2424+ // Note that in all cases, the pre-normalized and normalized intervals are semantically the same
2425+ // (i.e., they represent the same exact range) even if they are represented using different
2426+ // individual component values (i.e., low, high, lowClosed, and highClosed values).
2427+ //
2428+ // Examples:
2429+ // - Interval[-2147483648, 10] --> Interval[null, 10]
2430+ // - Interval[Uncertainty(-2147483648, 0), 10] --> Interval(null, 10]
2431+ // - Interval[-10, 10] --> Interval[-10, 10] (no change)
24152432function normalizeInterval(interval) {
24162433 const ivl = interval.copy();
24172434 const minValue = (0, math_1.minValueForType)(ivl.pointType, getQuantityInstanceForMinMax(ivl));
0 commit comments