PoshCode Archive  Artifact [a18c3e4556]

Artifact a18c3e455652026600a3c8fecf97e3bdb0a9434d710dcfdde734c5269109f8d3:

  • File Get-GrowthRate.ps1 — part of check-in [a12004e7bd] at 2018-06-10 14:22:52 on branch trunk — Calculates percentage growth rate given a starting value, ending value, and number of periods in the range. stahler thx! (user: halr9000 size: 570)

# encoding: ascii
# api: powershell
# title: Get-GrowthRate
# description: Calculates percentage growth rate given a starting value, ending value, and number of periods in the range.  stahler thx!
# version: 0.1
# type: function
# author: halr9000
# license: CC0
# function: Get-GrowthRate
# x-poshcode-id: 704
# x-archived: 2009-01-06T13:57:31
#
# Corrected period variable name - djryan
#
function Get-GrowthRate {
	param( $Start, $End, $Period ) 
	$rate = [math]::Abs( [math]::Pow( ( $End / $Start ),( 1 / $Period - 1 ) ) - 1 )
	"{0:P}" -f $rate
}