Module: CashFlowAnalysis::Calculator::Cagr

Defined in:
lib/cash_flow_analysis/calculator/cagr.rb

Class Method Summary collapse

Class Method Details

.calculate(start_value, end_value, years) ⇒ Numeric

Calculates the CAGR based on a start value, end value, and a term.

Parameters:

  • start_value (Numeric)

    the start value

  • end_value (Numeric)

    the end value

  • years (Fixnum)

    the number of years

Returns:

  • (Numeric)

    the year over year growth rate


10
11
12
# File 'lib/cash_flow_analysis/calculator/cagr.rb', line 10

def self.calculate(start_value, end_value, years)
  ((end_value.to_f / start_value) ** (1.0 / (years))) - 1
end