Revert "Revert "Add inflation to epoch phases (#6787)" (#6802)" (#6806)

automerge
This commit is contained in:
Sagar Dhawan
2019-11-07 18:33:14 -08:00
committed by Grimes
parent b64b54f48f
commit 80a89b5e6d
5 changed files with 127 additions and 25 deletions

View File

@ -42,6 +42,16 @@ impl Default for Inflation {
}
impl Inflation {
pub fn new_disabled() -> Self {
Self {
initial: 0.0,
terminal: 0.0,
taper: 0.0,
foundation: 0.0,
foundation_term: 0.0,
storage: 0.0,
}
}
/// inflation rate at year
pub fn total(&self, year: f64) -> f64 {
let tapered = self.initial * ((1.0 - self.taper).powf(year));