PoshCode Archive  Artifact [712d1c1dba]

Artifact 712d1c1dba6151395a8d88c5b3705df6d4dac785175ee1c79e5db2f7f46ccfd8:

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

# 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: Stahler
# license: CC0
# function: Get-GrowthRate
# x-poshcode-id: 702
# x-archived: 2009-01-06T15:37:28
#
#
function Get-GrowthRate {
	param( $Start, $End, $Period ) 
	$rate = [math]::Abs( [math]::Pow( ( $End / $Start ),( 1 / ( $Period - 1 ) ) ) - 1 )
	"{0:P}" -f $rate
}