// Find the first demand period that cannot be filled from current stock. Return the number of fully served periods. pub fn inventory_days(stock: f64, demand: vector) -> i64 { if stock<0.0 { return -1; } let mut remaining = stock; let mut i = 0; while iremaining { return i; } remaining -= need; i += 1; } i }