Skip to main content

Module total

Module total 

Source
Expand description

Total is a floating point type, suitable for use in ranges. All values are valid.

Ordering and other semantics are as per total_cmp.
Every distinct bit pattern is a separate valid value, even though quite a few of them are NaN.
For example, in a TotalF32 all 16 million different NaN values are distinct from each other.

Enable with float_experimental (stable, TotalF32/TotalF64) and float_nightly_experimental (nightly, adds TotalF16/TotalF128).

use range_set_blaze::{RangeSetBlaze, TotalF64, TotalF32};
let set = RangeSetBlaze::from_iter([TotalF64::new(3.0)..=TotalF64::new(5.0)]);
assert!(set.contains(TotalF64::new(3.1)));
assert!(!set.contains(TotalF64::new(2.9)));

let set = RangeSetBlaze::from(TotalF64::from_primitive_range(3.0..=5.0));
assert!(set.contains(TotalF64::new(4.9)));
assert!(!set.contains(TotalF64::new(5.1)));

let set = RangeSetBlaze::from_iter(TotalF32::from_primitive_ranges([3.0..=5.0, 7.0..=9.0]));
assert!(set.contains(TotalF32::new(4.0)));
assert!(!set.contains(TotalF32::new(6.0)));

Structs§

Total
Experimental: A transparent wrapper around floating point values with total ordering.

Traits§

TotalRangeExt
Extension trait for converting an inclusive Total range into an inclusive primitive range (or a (start, end) primitive tuple).
TotalSliceExt
Extension trait for viewing a slice of Total values as primitive values.

Functions§

tf32
Construct a TotalF32 from an f32. Shorthand for TotalF32::new
tf64
Construct a TotalF64 from an f64. Shorthand for TotalF64::new

Type Aliases§

TotalF32
Total ordered f32, all values valid, including NaN, -0.0, +0.0, and infinities.
TotalF64
Total ordered f64, all values valid, including NaN, -0.0, +0.0, and infinities.