Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Full support for Complex cotanh and acotanh.
  • Loading branch information
colomon committed Oct 3, 2009
1 parent 7bfbe77 commit 197b1e1
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 @@ -134,7 +134,7 @@ class Any is also {
self.Num.cosech($base);
}

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

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

our Num multi method acotanh($base = 'radians') is export {
our Num multi method acotanh($base = 'radians') {
self.Num.acotanh($base);
}
}
Expand Down Expand Up @@ -284,6 +284,14 @@ multi sub acosech($x, $base = 'radians') {
$x.acosech($base)
}

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

multi sub acotanh($x, $base = 'radians') {
$x.acotanh($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 @@ -112,6 +112,14 @@ class Complex {
(1 / self).asinh($base);
}

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

multi method acotanh($base = 'radians') {
(1 / self).atanh($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 @@ -74,7 +74,7 @@ class Num is also {
$r!from-radians($base)
}
our Num multi method acotanh($base = 'radians') is export {
our Num multi method acotanh($base = 'radians') {
my $r = Q:PIR {
$N0 = self
$N1 = 1 + $N0
Expand Down Expand Up @@ -219,7 +219,7 @@ class Num is also {
}
}

our Num multi method cotanh($base = 'radians') is export {
our Num multi method cotanh($base = 'radians') {
my $x = self!to-radians($base);
Q:PIR {
$P0 = find_lex "$x"
Expand Down

0 comments on commit 197b1e1

Please sign in to comment.