You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Split(step) and Values(step) end early when n × step overflows (Int64, Decimal, Float64, Float32) #219
area/rangesRange unions, variants and the shape enginesbugSomething isn't workingpackage/coreAffects CodoMetis.ValueRangesseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
Split(step) and Values(step) stop early, without an error, when n × step overflows while start + n × step would still fit. Each type's Steps lambda computes the n-th boundary as start + n * step. RangeSplitting.Steps catches the overflow and returns null, which SplitWalk/ValuesWalk read as "the domain has ended". Found by the pre-tag analysis (#179) on origin/main 3ce68d9.
Int64Range.CreateFinite(-9e18, 9e18).Values(4e18) → -9e18, -5e18, -1e18. It drops 3e18 and 7e18.
.Split(4e18) returns a last piece [-1e18,9e18], 10e18 wide for a 4e18 step.
The same happens for DecimalRange ([-7e28,7e28).Split(3e28)), Float64Range ([-1.7e308,1.7e308).Split(1e308)) and Float32Range ([-3.3e38,3.3e38).Split(2e38)).
Int32Range is safe because it computes n * step in long.
This breaks R39 ("Values(step) yields every k-th value") and the "pieces of the step length" contract. Every test passes with the defect present: Split_PiecesAreTheRange_AdjacentAndOneStepLong and R39's oracles never draw a negative start with a step near the domain's width.
Return null only when the boundary itself leaves the domain. For example, step from the previous boundary (previous + step, which is exact for integers and decimal) once n × step overflows, or compute in a wider type. For the floats, check that stepping from the previous boundary doesn't accumulate rounding error in a way that disagrees with start + n × step; if it does, pick one rule and document it.
Done when
Int64Range.CreateFinite(-9e18, 9e18).Values(4e18) is [-9e18, -5e18, -1e18, 3e18, 7e18].
The Split/Values oracle draws a row with start ≈ MinValue/2 and step ≈ MaxValue/2 for each type, and fails with the defect restored.
area/rangesRange unions, variants and the shape enginesbugSomething isn't workingpackage/coreAffects CodoMetis.ValueRangesseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
Activity