Permalink
Browse files

make log.t pass again

  • Loading branch information...
1 parent 3cae1b4 commit c14785bb303705977de9cafd4df8d97127943478 @moritz moritz committed Jul 4, 2011
Showing with 12 additions and 1 deletion.
  1. +11 −0 src/core/Numeric.pm
  2. +1 −1 t/spectest.data
View
@@ -5,6 +5,11 @@ my class Numeric {
multi method ACCEPTS(Numeric:D: $a) { $a == self }
proto method log(|$) {*}
+ multi method log(Cool $base) { self.log / $base.Numeric.log }
+ multi method log(Numeric $base) { self.log / $base.log }
+
+ method log10() { self.log / 10e0.log }
+
proto method exp(|$) {*}
multi method exp(Numeric $base) {
self.exp * $base.log;
@@ -26,6 +31,12 @@ multi prefix:<abs>(\$a) { abs $a.Numeric }
proto sub log(|$) {*}
multi sub log(Numeric $x) { $x.log }
multi sub log(Numeric $x, Numeric $base) { $x.log($base) }
+multi sub log(Cool $x) { $x.Numeric.log }
+multi sub log(Cool $x, Cool $base) { $x.Numeric.log($base.Numeric) }
+
+proto sub log10(|$) {*}
+multi sub log10(Numeric $x) { $x.log(10e0) }
+multi sub log10(Cool $x) { $x.Numeric.log(10e0) }
proto sub exp(|$) {*}
multi sub exp(Numeric $x) { $x.exp }
View
@@ -520,7 +520,7 @@ S32-num/complex.t
# S32-num/exp.t
# S32-num/gcd.t
# S32-num/int.t
-# S32-num/log.t
+S32-num/log.t
# S32-num/pi.t
S32-num/polar.t
# S32-num/power.t

0 comments on commit c14785b

Please sign in to comment.