Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more FatRat type fixes; run the tests!
  • Loading branch information
moritz committed Feb 13, 2012
1 parent 306626c commit 125e7f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/Rat.pm
Expand Up @@ -4,7 +4,7 @@ my role Rational is Real {
has Int $.numerator;
has Int $.denominator;

multi method WHICH(Rat:D:) {
multi method WHICH(Rational:D:) {
nqp::box_s(
nqp::concat_s(
nqp::concat_s(nqp::unbox_s(self.^name), '|'),
Expand Down Expand Up @@ -44,11 +44,11 @@ my role Rational is Real {
self.Num.Str
}
method succ {
Rat.new($!numerator + $!denominator, $!denominator);
self.new($!numerator + $!denominator, $!denominator);
}

method pred {
Rat.new($!numerator - $!denominator, $!denominator);
self.new($!numerator - $!denominator, $!denominator);
}
}

Expand Down Expand Up @@ -191,7 +191,11 @@ multi sub infix:</>(Rational \$a, Rational \$b) {
}

multi sub infix:</>(Rational \$a, Int \$b) {
$a.numerator / ($a.denominator * $b);
DIVIDE_NUMBERS
$a.numerator,
$a.denominator * $b,
$a,
$b;
}

multi sub infix:</>(Int \$a, Rational \$b) {
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -552,6 +552,7 @@ S32-num/base.t
S32-num/complex.t
S32-num/cool-num.t
S32-num/exp.t
S32-num/fatrat.t
S32-num/int.t
S32-num/log.t
S32-num/pi.t
Expand Down

0 comments on commit 125e7f9

Please sign in to comment.