Alt e.pl

From Organic Design wiki
Revision as of 13:20, 8 December 2011 by Nad (talk | contribs) (Category:PERL)

<perl>

  1. 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; } </perl>