Skip to main content

rule_of_69

Function rule_of_69 

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

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

Often closer to continuous compounding than the Rule of 72.

§Errors

Same domain as rule_of_72.

§Examples

use finance_solution::{rule_of_69, FinanceError};

assert!((rule_of_69(0.08).unwrap() - 8.625).abs() < 1e-12); // 69/8
match rule_of_69(-0.01) {
    Err(FinanceError::InvalidRate { rate }) => assert!(rate < 0.0),
    other => panic!("expected InvalidRate, got {other:?}"),
}