Skip to content

Commit

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

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

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

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

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

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

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

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

multi method acosech($base = 'radians') {
(1 / self).asinh($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 @@ -57,7 +57,7 @@ class Num is also {
$r!from-radians($base)
}

our Num multi method acosech($base = 'radians') is export {
our Num multi method acosech($base = 'radians') {
# MUST: This is certainly wrong -- if nothing else,
# asinh also calls from-radians on its result.
# (Except it seems to be passing tests?)
Expand Down Expand Up @@ -197,7 +197,7 @@ class Num is also {
};
}

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

0 comments on commit 7bfbe77

Please sign in to comment.