Intervals.jl icon indicating copy to clipboard operation
Intervals.jl copied to clipboard

Contiguous detection with discrete values

Open omus opened this issue 7 years ago • 2 comments

For intervals using discrete units like integers the intervals [1,2] and [3,4] should be contiguous (no values can exist between these intervals). Most likely implementing this would require an additional trait so we can increase a type by a single discrete value. For Integer this would be one but for DateTime it would be milliseconds while Date would be days.

omus avatar Jun 04 '18 18:06 omus

So with this

union([1..2, 3..4]) == [1..4]

would be true, but

a = 3.
b = a + eps(a)
c = b + eps(b)
d = c + eps(c)
union([a..b,c..d]) == [a..d]

not?

The second code example still adheres to your definition of "no values can exist between these intervals".

Whats your opinion on whether intervals should be based on the internal representation (e.g. of floats) or purely on the mathematical definition?

laborg avatar Aug 15 '18 08:08 laborg

I think your floating-point interval example would be contiguous. This does mean we would be using the internal representation rather for this behaviour.

omus avatar Aug 15 '18 19:08 omus