Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Real.ACCEPTS.
  • Loading branch information
colomon committed Jun 21, 2010
1 parent 88210a9 commit b98d7fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Numeric.pm
@@ -1,5 +1,5 @@
role Numeric {
multi method ACCEPTS($other) {
method ACCEPTS($other) {
my @a = self.reals;
my @b = (+$other).reals;
if @a.grep("NaN").elems > 0 {
Expand Down
8 changes: 8 additions & 0 deletions src/core/Real.pm
@@ -1,6 +1,14 @@
class Complex { ... }

role Real does Numeric {
method ACCEPTS($other) {
if self eq "NaN" {
(+$other).reals.grep("NaN").elems > 0;
} else {
$other == self;
}
}

method Bridge() {
fail "Bridge must be defined for the Real type " ~ self.WHAT;
}
Expand Down

0 comments on commit b98d7fa

Please sign in to comment.