real_interval 0.1.0

Continuous interval arithmetic library.
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented1 out of 17 items with examples
  • Size
  • Source code size: 11.66 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • DouglasDwyer/real_interval
    4 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DouglasDwyer

real_interval

Crates.io Docs.rs

RealInterval provides an f32-backed continuous interval type for ergonomic interval manipulation. Scalar operations, arithmetic operations, and set operations on intervals are all supported. The following is a simple example of how to use intervals:

let interval = RealInterval::min_max(-1.0, 2.0);
let shifted_interval = interval + 0.5;
let expanded_interval = RealInterval::min_max(-2.0, 3.0) * interval;

assert_eq!(RealInterval::min_max(-0.5, 2.5), shifted_interval);
assert_eq!(RealInterval::min_max(-4.0, 6.0), expanded_interval);

let and_interval = interval & shifted_interval;
let or_interval = interval | shifted_interval;

assert_eq!(Some(RealInterval::min_max(-0.5, 2.0)), and_interval);
assert_eq!(RealInterval::min_max(-1.0, 2.5), or_interval);