Skip to content
Permalink
Browse files

Fixed the bug #2688 (wrong values for asinh of negative argument)

  • Loading branch information...
ramillies committed Feb 10, 2019
1 parent d904b70 commit 5281c23a11ffeae1e43ddb5576eb680d5442848f
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/core/Num.pm6
@@ -197,7 +197,10 @@ my class Num does Real { # declared in BOOTSTRAP
multi method asinh(Num:D: ) {
nqp::isnanorinf(self)
?? self
!! (self + (self * self + 1e0).sqrt).log;
!!
self >= 0
?? (self + (self * self + 1e0).sqrt).log
!! -(-1e0 * self).asinh
}
proto method cosh(|) {*}
multi method cosh(Num:D: ) {
@@ -559,12 +562,14 @@ multi sub asinh(num $x --> num) {
# ln(x + √(x²+1))
nqp::isnanorinf($x)
?? $x
!! nqp::log_n(
nqp::add_n(
$x,
nqp::pow_n( nqp::add_n(nqp::mul_n($x,$x), 1e0), .5e0 )
!! $x >= 0
?? nqp::log_n(
nqp::add_n(
$x,
nqp::pow_n( nqp::add_n(nqp::mul_n($x,$x), 1e0), .5e0 )
)
)
)
!! -asinh(-$x);
}

multi sub cosh(num $x --> num) {

0 comments on commit 5281c23

Please sign in to comment.
You can’t perform that action at this time.