Skip to content

Commit

Permalink
Full support for Complex cosec and acosec.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Oct 2, 2009
1 parent be44f6a commit f529b41
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/setting/Any-num.pm
Expand Up @@ -106,7 +106,7 @@ class Any is also {
# self.Num.sec($base);
# }

our Num multi method cosec($base = 'radians') is export {
our Num multi method cosec($base = 'radians') {
self.Num.cosec($base);
}

Expand Down Expand Up @@ -158,7 +158,7 @@ class Any is also {
self.Num.asec($base);
}

our Num multi method acosec($base = 'radians') is export {
our Num multi method acosec($base = 'radians') {
self.Num.acosec($base);
}

Expand Down Expand Up @@ -228,6 +228,14 @@ multi sub asec($x, $base = 'radians') {
$x.asec($base)
}

multi sub cosec($x, $base = 'radians') {
$x.cosec($base)
}

multi sub acosec($x, $base = 'radians') {
$x.acosec($base)
}

our Num sub rand (*@args) {
die "too many arguments passed - 0 params expected" if @args;
1.rand
Expand Down
8 changes: 8 additions & 0 deletions src/setting/Complex.pm
Expand Up @@ -56,6 +56,14 @@ class Complex {
(1 / self).acos($base);
}

multi method cosec($base = 'radians') {
1 / self.sin($base);
}

multi method acosec($base = 'radians') {
(1 / self).asin($base);
}

multi method log() {
Q:PIR {
$P0 = get_root_namespace ['parrot'; 'Complex' ]
Expand Down
4 changes: 2 additions & 2 deletions src/setting/Num.pm
Expand Up @@ -47,7 +47,7 @@ class Num is also {
$r!from-radians($base)
}
our Num multi method acosec($base = 'radians') is export {
our Num multi method acosec($base = 'radians') {
my $r = Q:PIR {
$N0 = self
$N1 = 1 / $N0
Expand Down Expand Up @@ -186,7 +186,7 @@ class Num is also {
};
}
our Num multi method cosec($base = 'radians') is export {
our Num multi method cosec($base = 'radians') {
my $x = self!to-radians($base);
Q:PIR {
$P0 = find_lex "$x"
Expand Down

0 comments on commit f529b41

Please sign in to comment.