pub struct FutureValue {
    pub cash_flow: f64,
    pub interest_rate: f64,
    pub time_periods: f64,
}
Expand description

Calculates the future value of a cash flow received today

Example

use com_croftsoft_core::math::finance_lib::FutureValue;
assert_eq!(
  FutureValue {
    cash_flow:     1.0,  // Investing $1 today
    interest_rate: 0.12, // At 12% per year
    time_periods:  6.0,  // For six years with interest compounded annually
  }.calculate(),
  1.973_822_685_184_001); // Will double your money (see the "Rule of 72")

Fields

cash_flow: f64

Cash flow invested or received today

interest_rate: f64

Interest, discount, or inflation rate (use 0.01 for 1%)

time_periods: f64

Number of periods from today when the value is evaluated

Implementations

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.