File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,9 +44,10 @@ impl ProcessAvailabilityRaw {
4444 /// `capacity_to_activity` units of capacity.
4545 fn to_bounds ( & self , ts_length : Year ) -> RangeInclusive < Dimensionless > {
4646 // We know ts_length also represents a fraction of a year, so this is ok.
47- let value = self . value * ts_length / Year ( 1.0 ) ;
47+ let ts_frac = ts_length / Year ( 1.0 ) ;
48+ let value = self . value * ts_frac;
4849 match self . limit_type {
49- LimitType :: LowerBound => value..=Dimensionless ( f64 :: INFINITY ) ,
50+ LimitType :: LowerBound => value..=ts_frac ,
5051 LimitType :: UpperBound => Dimensionless ( 0.0 ) ..=value,
5152 LimitType :: Equality => value..=value,
5253 }
@@ -310,7 +311,7 @@ mod tests {
310311 // Lower bound
311312 let raw = create_process_availability_raw ( LimitType :: LowerBound , Dimensionless ( 0.5 ) ) ;
312313 let bounds = raw. to_bounds ( ts_length) ;
313- assert_eq ! ( bounds, Dimensionless ( 0.05 ) ..=Dimensionless ( f64 :: INFINITY ) ) ;
314+ assert_eq ! ( bounds, Dimensionless ( 0.05 ) ..=Dimensionless ( 0.1 ) ) ;
314315
315316 // Upper bound
316317 let raw = create_process_availability_raw ( LimitType :: UpperBound , Dimensionless ( 0.5 ) ) ;
You can’t perform that action at this time.
0 commit comments