Skip to content

Commit

Permalink
port some Num methods over from alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Mar 12, 2010
1 parent e5d11fe commit f28f3c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/Num.pm
@@ -1,4 +1,19 @@
augment class Num {
multi method ACCEPTS($other) {
if self eq 'NaN' {
$other eq 'NaN';
} else {
$other == self;
}
}
multi method ACCEPTS(::Complex $other) {
if self eq 'NaN' {
$other.re eq 'NaN' || $other.im eq 'NaN';
} else {
$other.im == 0 && $other.re == self;
}
}

multi method Bool() {
self != 0.0e0
}
Expand Down

0 comments on commit f28f3c7

Please sign in to comment.