Browse files

infix == for Complex, wins us back any-complex.t. jnthn++

  • Loading branch information...
1 parent abd6769 commit 8b36d0979349ff5e60ab4b56e340f855ee00f8ef @moritz moritz committed Jul 4, 2011
Showing with 5 additions and 5 deletions.
  1. +0 −4 LHF.markdown
  2. +4 −0 src/core/Complex.pm
  3. +1 −1 t/spectest.data
View
4 LHF.markdown
@@ -11,10 +11,6 @@ new possible performance.
## Int.Rat
Add .Rat method to Int. Should get us S03-smartmatch/any-num.t.
-## Fix Complex.ACCEPTS
-Work out why (1 + 2i) ~~ (1 + 2i) is infinite recursion. Should get
-us S03-smartmatch/any-complex.t.
-
## Basic IO
the stat calls should be pretty straight-forward to port from master
View
4 src/core/Complex.pm
@@ -272,6 +272,10 @@ multi sub infix:<**>(Complex \$a, Complex \$b) { $b.exp * $a.log }
multi sub infix:<**>(Real \$a, Complex \$b) { $b.exp * $a.log }
multi sub infix:<**>(Complex \$a, Real \$b) { $b.exp * $a.log }
+multi sub infix:<==>(Complex \$a, Complex \$b) { $a.re == $b.re && $a.im == $b.im }
+multi sub infix:<==>(Complex \$a, Real \$b) { $a.re == $b && $a.im == 0e0 }
+multi sub infix:<==>(Real \$a, Complex \$b) { $a == $b.re && 0e0 == $b.im }
+
proto postfix:<i>(|$) { * }
multi postfix:<i>(Real \$a) { Complex.new(0e0, $a); }
multi postfix:<i>(Complex \$a) { Complex.new(-$a.im, $a.re) }
View
2 t/spectest.data
@@ -177,7 +177,7 @@ S03-operators/subscript-vs-lt.t
# S03-smartmatch/any-array.t
# S03-smartmatch/any-bool.t
S03-smartmatch/any-callable.t
-# S03-smartmatch/any-complex.t
+S03-smartmatch/any-complex.t
# S03-smartmatch/any-hash-pair.t
# S03-smartmatch/any-hash-slice.t
# S03-smartmatch/any-method.t

0 comments on commit 8b36d09

Please sign in to comment.