Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Int.unpolar and Num.unpolar.
  • Loading branch information
colomon committed Sep 30, 2009
1 parent d014a99 commit 2d34081
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/setting/Int.pm
Expand Up @@ -28,6 +28,10 @@ class Int is also {
our Num multi method sec($base = 'radians') is export {
self.Num.sec($base);
}

our Complex multi method unpolar($angle) is export {
Complex.new(self.Num * $angle.cos("radians"), self.Num * $angle.sin("radians"));
}
}

multi sub abs(Int $x) { $x.abs }
Expand Down
4 changes: 4 additions & 0 deletions src/setting/Num.pm
Expand Up @@ -311,4 +311,8 @@ class Num is also {
%r = box $N1
}
}

our Complex multi method unpolar(Num $angle) is export {
Complex.new(self * $angle.cos("radians"), self * $angle.sin("radians"));
}
}

0 comments on commit 2d34081

Please sign in to comment.