pub struct NumberRange {
pub start_of_range: f64,
pub end_of_range: f64,
}Expand description
A range of numbers.
What “start” and “end” mean depends on the field: for a power_range or a
fill_rate the start is the value at an operation-mode factor of 0 and the end the
value at 1, so the range is interpolated; for running_costs the range expresses
uncertainty and is not linked to the factor at all.
Fields§
§start_of_range: f64The start of the range.
end_of_range: f64The end of the range.
Implementations§
Source§impl NumberRange
impl NumberRange
Sourcepub fn contains(self, value: f64) -> bool
pub fn contains(self, value: f64) -> bool
Whether value lies within the range, inclusive of both ends.
Sourcepub fn ordered(self) -> (f64, f64)
pub fn ordered(self) -> (f64, f64)
The range as (low, high), whichever way round it was written.
Sourcepub fn at_factor(self, factor: f64) -> f64
pub fn at_factor(self, factor: f64) -> f64
Linear interpolation: the value at operation-mode factor.
the S2 documentation, Operation modes: power = (end - start) * factor + start.
Factors 0 and 1 return start and end exactly: in floating point
start + (end - start) * 1.0 is not always end, and both roles compare against
the number the description published (D30).