Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Int.gcd and a proto for a sub version.
  • Loading branch information
colomon committed Feb 16, 2011
1 parent cea2411 commit 67dfab4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/Int.pm
Expand Up @@ -29,6 +29,10 @@ augment class Int does Real {
method sign(Int $x:) {
$x.notdef ?? Mu !! $x <=> 0;
}

method gcd(Int $x: Int $y) {
pir::gcd__iii($x, $y);
}
}

multi sub infix:<cmp>(Int $a, Int $b) {
Expand Down Expand Up @@ -97,3 +101,5 @@ our multi sub infix:<**>(Int $a, Int $b) {
pir::pow__NNN($a, $b)
}
}

proto sub gcd($x, $y) { $x.gcd($y); }

0 comments on commit 67dfab4

Please sign in to comment.