Skip to content

Commit

Permalink
Allow Int factors in geometric series if possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Jul 22, 2010
1 parent c633afc commit 82b1b78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/operators.pm
Expand Up @@ -396,7 +396,11 @@ our multi sub infix:<...>(@lhs is copy, $rhs) {
} elsif @lhs[*-2] / @lhs[*-3] == @lhs[*-1] / @lhs[*-2] {
$is-geometric-switching-sign = (@lhs[*-2] * @lhs[*-1] < 0);
return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs) && !$is-geometric-switching-sign;
$next = { $_ * (@lhs[*-2] / @lhs[*-3]) };
my $factor = @lhs[*-2] / @lhs[*-3];
if $factor ~~ ::Rat && $factor.denominator == 1 {
$factor = $factor.Int;
}
$next = { $_ * $factor };
} else {
fail "Unable to figure out pattern of series";
}
Expand Down

0 comments on commit 82b1b78

Please sign in to comment.