Skip to content

Commit

Permalink
Change infix:<div> to return floor($a / $b) as in the spec. (Same as …
Browse files Browse the repository at this point in the history
…before for positive, different rounding direction for negative.)
  • Loading branch information
colomon committed Jun 7, 2010
1 parent b258f5c commit b497776
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/Int.pm
Expand Up @@ -51,7 +51,11 @@ our multi sub infix:<*>(Int $a, Int $b) {
}

our multi sub infix:<div>(Int $a, Int $b) {
pir::box__PI(pir::div__III($a, $b))
my $result = pir::box__PI(pir::div__III($a, $b));
if $a.sign * $b.sign < 0 && $result * $b != $a {
$result--;
}
$result;
}

our multi sub infix:<%>(Int $a, Int $b) {
Expand Down

0 comments on commit b497776

Please sign in to comment.