Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Complex.sqrt, tests

  • Loading branch information...
commit 56a1e10b13f1fa1a1299894b5ebce1783c89d0d7 1 parent 8f1d810
@moritz moritz authored
Showing with 6 additions and 1 deletion.
  1. +5 −0 src/core/Complex.pm
  2. +1 −1  t/spectest.data
View
5 src/core/Complex.pm
@@ -73,6 +73,11 @@ my class Complex is Numeric {
Complex.new($mag.log, $angle);
}
+ method sqrt() {
+ my Num ($mag, $angle) = self.polar;
+ $mag.sqrt.unpolar($angle/2);
+ }
+
multi method exp() {
my Num $mag = $!re.exp;
Complex.new($mag * $!im.cos, $mag * $!im.sin);
View
2  t/spectest.data
@@ -530,7 +530,7 @@ S32-num/polar.t
# S32-num/roots.t
# S32-num/rounders.t
# S32-num/sign.t
-# S32-num/sqrt.t
+S32-num/sqrt.t
S32-num/unpolar.t
S32-scalar/defined.t
# S32-scalar/undef.t
Please sign in to comment.
Something went wrong with that request. Please try again.