pub struct DoublingSolution { /* private fields */ }Expand description
Comparison of doubling-time methods at a single rate.
Create with doubling_solution.
§Examples
use finance_solution::*;
let s = doubling_solution(0.08).unwrap();
assert_rounded_2!(s.rule_of_72(), 9.0);
assert_rounded_4!(s.exact(), 9.0065);
// Table of method vs years (and error vs exact):
s.print_table();Sample print_table() output at 8%:
method years error_vs_exact
--------------- --------- ----------------
rule_of_72 9.0000 -0.0065
rule_of_70 8.7500 -0.2565
rule_of_69 8.6250 -0.3815
exact_discrete 9.0065 0.0000
exact_continuous 8.6643 -0.3421Implementations§
Source§impl DoublingSolution
impl DoublingSolution
pub fn rate(&self) -> f64
pub fn rule_of_72(&self) -> f64
pub fn rule_of_70(&self) -> f64
pub fn rule_of_69(&self) -> f64
Sourcepub fn exact_continuous(&self) -> f64
pub fn exact_continuous(&self) -> f64
Exact continuous compounding: ln(2) / r.
pub fn formula(&self) -> &str
pub fn symbolic_formula(&self) -> &str
Sourcepub fn error_rule_of_72(&self) -> f64
pub fn error_rule_of_72(&self) -> f64
Absolute error of Rule of 72 vs exact discrete doubling time.
Sourcepub fn print_table(&self)
pub fn print_table(&self)
Print method comparison at this rate.
pub fn print_table_locale(&self, locale: &Locale, precision: usize)
Trait Implementations§
Source§impl Clone for DoublingSolution
impl Clone for DoublingSolution
Source§fn clone(&self) -> DoublingSolution
fn clone(&self) -> DoublingSolution
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DoublingSolution
impl RefUnwindSafe for DoublingSolution
impl Send for DoublingSolution
impl Sync for DoublingSolution
impl Unpin for DoublingSolution
impl UnsafeUnpin for DoublingSolution
impl UnwindSafe for DoublingSolution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more