Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sech and asech, slightly reorder the methods in Real.
  • Loading branch information
colomon committed Aug 15, 2011
1 parent e8a10fb commit 342e6d9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/core/Complex.pm
Expand Up @@ -162,14 +162,14 @@ my class Complex is Numeric {
(((1 + self) / (1 - self)).log / 2);
}

# method sech(Complex:D:) {
# 1 / self.cosh;
# }
#
# method asech(Complex:D:) {
# (1 / self).acosh;
# }
#
method sech(Complex:D:) {
1 / self.cosh;
}

method asech(Complex:D:) {
(1 / self).acosh;
}

# method cosech(Complex:D:) {
# 1 / self.sinh;
# }
Expand Down
2 changes: 2 additions & 0 deletions src/core/Cool.pm
Expand Up @@ -23,6 +23,8 @@ my class Cool {
method acosh() { self.Numeric.acosh }
method tanh() { self.Numeric.tanh }
method atanh() { self.Numeric.atanh }
method sech() { self.Numeric.sech }
method asech() { self.Numeric.asech }

## string methods

Expand Down
4 changes: 4 additions & 0 deletions src/core/Num.pm
Expand Up @@ -162,6 +162,10 @@ my class Num {
multi method sech(Num:D: ) {
nqp::p6box_n(pir::sech__NN(nqp::unbox_n(self)));
}
proto method asech(|$) {*}
multi method asech(Num:D: ) {
(1 / self).acosh;
}
}

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

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

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

proto sub sqrt(|$) {*}
multi sub sqrt(Numeric \$x) { $x.sqrt }
multi sub sqrt(Cool \$x) { $x.Numeric.sqrt }
Expand Down
16 changes: 9 additions & 7 deletions src/core/Real.pm
Expand Up @@ -14,6 +14,13 @@ my class Real {
method acos() { self.Bridge.acos }
method tan() { self.Bridge.tan }
method atan() { self.Bridge.atan }
proto method atan2(|$) {*}
multi method atan2(Real $x = 1e0) { self.Bridge.atan2($x.Bridge) }
multi method atan2(Cool $x = 1e0) { self.Bridge.atan2($x.Numeric.Bridge) }
method sec() { self.Bridge.sec }
method asec() { self.Bridge.asec }
method cosec() { self.Bridge.cosec }
method acosec() { self.Bridge.acosec }
method cotan() { self.Bridge.cotan }
method acotan() { self.Bridge.acotan }
method sinh() { self.Bridge.sinh }
Expand All @@ -22,13 +29,8 @@ my class Real {
method acosh() { self.Bridge.acosh }
method tanh() { self.Bridge.tanh }
method atanh() { self.Bridge.atanh }
proto method atan2(|$) {*}
multi method atan2(Real $x = 1e0) { self.Bridge.atan2($x.Bridge) }
multi method atan2(Cool $x = 1e0) { self.Bridge.atan2($x.Numeric.Bridge) }
method sec() { self.Bridge.sec }
method asec() { self.Bridge.asec }
method cosec() { self.Bridge.cosec }
method acosec() { self.Bridge.acosec }
method sech() { self.Bridge.sech }
method asech() { self.Bridge.asech }
method floor() { self.Bridge.floor }
method ceiling() { self.Bridge.ceiling }
method unpolar(Real $angle) {
Expand Down

0 comments on commit 342e6d9

Please sign in to comment.