Permalink
Browse files

more FatRat type fixes; run the tests!

  • Loading branch information...
1 parent 306626c commit 125e7f9588197df69a43fdbd8567cbdfab66f0e2 @moritz moritz committed Feb 13, 2012
Showing with 9 additions and 4 deletions.
  1. +8 −4 src/core/Rat.pm
  2. +1 −0 t/spectest.data
View
@@ -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), '|'),
@@ -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);
}
}
@@ -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) {
View
@@ -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

0 comments on commit 125e7f9

Please sign in to comment.