Skip to content

Commit

Permalink
Make protos for log and log10, implement Any.log10 and Num.log10.
Browse files Browse the repository at this point in the history
Tidy things a tiny bit as well.
  • Loading branch information
colomon committed Dec 7, 2009
1 parent a1468ab commit bbfd577
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/core/Any-num.pm
Expand Up @@ -62,7 +62,11 @@ augment class Any {
}

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

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

our Num multi method sin($base = 'radians') {
Expand Down Expand Up @@ -170,10 +174,10 @@ augment class Any {
}
}

our multi sub abs($x) { (+$x).abs() }
our proto sub exp($exponent) { $exponent.exp() }
our multi sub log($x) { $x.Num.log() }
our multi sub log10($x) { $x.Num.log10 }
our multi sub abs($x) { (+$x).abs }
our proto sub exp($exponent) { $exponent.exp }
our proto sub log($x) { $x.log }
our proto sub log10($x) { $x.log10 }

# jnthn says that we should have both the multi sub declaration and the proto.

Expand Down
4 changes: 4 additions & 0 deletions src/core/Num.pm
Expand Up @@ -19,6 +19,10 @@ augment class Num {
pir::ln__Nn(self);
}

multi method log10() {
pir::log10__Nn(self);
}

multi method sqrt() {
pir::sqrt__Nn(self);
}
Expand Down

0 comments on commit bbfd577

Please sign in to comment.