Skip to content

Commit

Permalink
Move Rat.Str to Real (with tweaks), delete Rat.Int tweak other Real.S…
Browse files Browse the repository at this point in the history
…tr methods so things still work.
  • Loading branch information
colomon committed Jun 10, 2010
1 parent 2c1c3d7 commit b461fd2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cheats/num.pm
@@ -1,5 +1,5 @@
augment class Num {
our Str multi method Str() {
our Str method Str() {
~self
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Complex.pm
Expand Up @@ -25,7 +25,7 @@ class Complex does Numeric is Cool {
"Complex.new($.re, $.im)";
}

multi method Str() {
method Str() {
"$.re + {$.im}i";
}

Expand Down
4 changes: 0 additions & 4 deletions src/core/Rat.pm
Expand Up @@ -32,17 +32,13 @@ class Rat is Cool does Real {

method Bool() { $!numerator != 0 ?? Bool::True !! Bool::False }

method Int() { self.Num.Int; }

method Rat(Real $epsilon = 1.0e-6) { self; }

method Num() {
$!denominator == 0 ?? Inf * $!numerator.sign
!! $!numerator.Num / $!denominator.Num;
}

multi method Str() { $.Num.Str; }

multi method nude() { $.numerator, $.denominator; }

method succ {
Expand Down
4 changes: 4 additions & 0 deletions src/core/Real.pm
Expand Up @@ -25,6 +25,10 @@ role Real does Numeric {
Complex.new(self, 0);
}

method Str() {
self.Bridge.Str;
}

method reals() {
(self);
}
Expand Down

0 comments on commit b461fd2

Please sign in to comment.