Skip to content

Instantly share code, notes, and snippets.

@AspenForester
Created April 29, 2020 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AspenForester/a75ad72f325e7439c415df26d37e9f9b to your computer and use it in GitHub Desktop.
Save AspenForester/a75ad72f325e7439c415df26d37e9f9b to your computer and use it in GitHub Desktop.
Exponentiation, produces the same results as the .Net method [math]::exp(). Uses the Factorial function in another of my gists
function exp ($x)
{
[double]$sum = 1
foreach ($n in (1..100))
{
$sum += [Double]([math]::Pow($x, $n)/[double](Factorial $n))
}
$sum
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment