Alt e.pl
From Organic Design wiki
# Returns e^x from e( x, iterations )
sub e {
$x = $y = shift;
$top = $bot = 1;
for $n ( 1 .. shift ) {
$y = $y + $x;
$top = $top * $n + $y;
$bot = $bot * $n;
}
return $top / $bot;
}
# Returns e^x from e( x, iterations )
sub e {
$x = $y = shift;
$top = $bot = 1;
for $n ( 1 .. shift ) {
$y = $y + $x;
$top = $top * $n + $y;
$bot = $bot * $n;
}
return $top / $bot;
}