pub struct PresentValuePaymentStream {
    pub cash_flow: f64,
    pub inflation_rate: f64,
    pub time_periods: f64,
}
Expand description

Calculates the present value of a payment stream such as an annuity

Example

use com_croftsoft_core::math::finance_lib::PresentValuePaymentStream;
assert_eq!(
  PresentValuePaymentStream {
    cash_flow :     1.0,  // A dollar every year starting a year from today
    inflation_rate: 0.10, // With inflation at 10% per year
    time_periods:   10.0, // For ten years
  }.calculate(),
  6.144567105704685);     // Is the same as receiving ~$6.14 today

Fields

cash_flow: f64inflation_rate: f64

The inflation rate or interest rate per time period (use 0.01 for 1%)

time_periods: f64

Number of time periods of cash income

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.