Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cotanh and acotanh.
  • Loading branch information
colomon committed Aug 15, 2011
1 parent a61f7d4 commit df103f0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/Complex.pm
Expand Up @@ -178,13 +178,13 @@ my class Complex is Numeric {
(1 / self).asinh;
}

# method cotanh(Complex:D:) {
# 1 / self.tanh;
# }
#
# method acotanh(Complex:D:) {
# (1 / self).atanh;
# }
method cotanh(Complex:D:) {
1 / self.tanh;
}

method acotanh(Complex:D:) {
(1 / self).atanh;
}
}

multi sub prefix:<->(Complex:D \$a) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/Cool.pm
Expand Up @@ -27,6 +27,8 @@ my class Cool {
method asech() { self.Numeric.asech }
method cosech() { self.Numeric.cosech }
method acosech() { self.Numeric.acosech }
method cotanh() { self.Numeric.cotanh }
method acotanh() { self.Numeric.acotanh }

## string methods

Expand Down
8 changes: 8 additions & 0 deletions src/core/Num.pm
Expand Up @@ -174,6 +174,14 @@ my class Num {
multi method acosech(Num:D: ) {
(1 / self).asinh;
}
proto method cotanh(|$) {*}
multi method cotanh(Num:D: ) {
nqp::p6box_n(nqp::div_n(1, pir::tanh__NN(nqp::unbox_n(self))));
}
proto method acotanh(|$) {*}
multi method acotanh(Num:D: ) {
(1 / self).atanh;
}
}

my constant pi = 3.14159265e0;
Expand Down
8 changes: 8 additions & 0 deletions src/core/Numeric.pm
Expand Up @@ -140,6 +140,14 @@ proto sub acosech(|$) {*}
multi sub acosech(Numeric \$x) { $x.acosech }
multi sub acosech(Cool \$x) { $x.Numeric.acosech }

proto sub cotanh(|$) {*}
multi sub cotanh(Numeric \$x) { $x.cotanh }
multi sub cotanh(Cool \$x) { $x.Numeric.cotanh }

proto sub acotanh(|$) {*}
multi sub acotanh(Numeric \$x) { $x.acotanh }
multi sub acotanh(Cool \$x) { $x.Numeric.acotanh }

proto sub sqrt(|$) {*}
multi sub sqrt(Numeric \$x) { $x.sqrt }
multi sub sqrt(Cool \$x) { $x.Numeric.sqrt }
Expand Down
2 changes: 2 additions & 0 deletions src/core/Real.pm
Expand Up @@ -33,6 +33,8 @@ my class Real {
method asech() { self.Bridge.asech }
method cosech() { self.Bridge.cosech }
method acosech() { self.Bridge.acosech }
method cotanh() { self.Bridge.cotanh }
method acotanh() { self.Bridge.acotanh }
method floor() { self.Bridge.floor }
method ceiling() { self.Bridge.ceiling }
method unpolar(Real $angle) {
Expand Down

0 comments on commit df103f0

Please sign in to comment.