Created
July 20, 2010 11:37
-
-
Save colomon/482850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub sine-power($x) { | |
my $sign = 1; | |
my $x-part = $x; | |
my $denom = 1; | |
gather for 3, 5 ... * -> $n { | |
take $sign * $x-part / $denom; | |
$sign *= -1; | |
$x-part *= $x * $x; | |
$denom *= $n * ($n - 1); | |
} | |
} | |
say sine-power(0.1).munch(4).perl; | |
say ([+] sine-power(0.1).munch(3)).perl; | |
say [+] sine-power(0.1).munch(3); | |
say sin(0.1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment