# Crate interval[−][src]

## Expand description

This library proposes structures for interval arithmetic, most set operations are implemented.

# Overflow behavior

Nothing special is done against overflow beside the checks done by Rust in debug mode for arithmetic overflows.

# Limits

Interval bounds must implement, for most operations, the `Width`

trait. This is because the maximum size of an n-bits interval can not fit in an n-bits integer. Consider the interval `[0..1]`

with 1-bit bounds, the size `2`

can not be represented with only one bit. It needs `n+1`

bits, and this is problematic with the largest primitive types such as `u64`

. Therefore, the interval bounds must be used within the limits of `Width::min_value()`

and `Width::max_value()`

, and not by the limits provided by `num::traits::Bounded`

.

# Examples

For examples see the interval module, interval set module.

# References

- Boost Interval Arithmetic Library
- Boost Interval Container Library
- T.J. Hickey, Qun Ju, and M.H. van Emden. Interval arithmetic: from principles to implementation. Journal of the ACM, 48(5):1038-1068, 2001.

## Re-exports

`pub use crate::interval::Interval;`

`pub use crate::interval_set::IntervalSet;`

## Modules

Closed and bounded generic interval.

Closed and bounded generic interval set.

Interval and bound specific operations.