pub fn doubling_solution(rate: f64) -> FinanceResult<DoublingSolution>Expand description
Build a DoublingSolution comparing Rule of 72/70/69 with exact discrete and continuous times.
§Errors
Propagates validation failures from the underlying doubling formulas.
§Examples
use finance_solution::{doubling_solution, FinanceError};
let s = doubling_solution(0.10).unwrap();
// Symmetry: $1 grown at r for exact periods ≈ $2
let grown = (1.0_f64 + s.rate()).powf(s.exact());
assert!((grown - 2.0).abs() < 1e-9);
match doubling_solution(-0.05) {
Err(FinanceError::InvalidRate { .. }) => {}
other => panic!("expected InvalidRate, got {other:?}"),
}