Skip to main content

rule_of_70

Function rule_of_70 

Source
pub fn rule_of_70(rate: f64) -> FinanceResult<f64>
Expand description

Approximate years to double using the Rule of 70: 70 / (100 * rate).

§Errors

Same domain as rule_of_72.

§Examples

use finance_solution::{rule_of_70, FinanceError};

assert!((rule_of_70(0.08).unwrap() - 8.75).abs() < 1e-12); // 70/8
assert!(matches!(rule_of_70(0.0), Err(FinanceError::ZeroValue { .. })));