Difference between revisions of "Alt e.pl"
From Organic Design wiki
(rm security settings) |
m |
||
Line 1: | Line 1: | ||
− | + | # Returns e^x from e( x, iterations ){{perl}} | |
− | # Returns e^x from e( x, iterations ) | ||
sub e { | sub e { | ||
$x = $y = shift; | $x = $y = shift; |
Revision as of 01:11, 12 July 2007
- Returns e^x from e( x, iterations )Our Perl scripts.
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; }