[Python-bugs-list] Inverse hyperbolic functions in cmath module (PR#231)

guido@python.org guido@python.org
Fri, 10 Mar 2000 18:42:08 -0500 (EST)


> Full_Name: Nadav Horesh
> Version: 1.52
> OS: NT 4.0 SP4
> Submission from: (NULL) (212.25.119.223)
> 
> 
> 1.  The function cmath.acosh provides the negative branch with low 
> precision. For example:
> 
> >>> cmath.acosh(cmath.cosh(10.0))
> (-10.0000000135+0j)
> 
> Proposed solution --- use the following formula which is precise and
> avoids singularities with complex arguments:
> 
> def acosh(x):
>    return 2.0*log(sqrt(x+1.0) + sqrt(x-1.0)) - log(2.0)
> 
> 2.  The function cmath.sinh does not handle moderately large 
> arguments. For example:
> 
> >>> cmath.asinh(cmath.sinh(20.0))
> (1.#INF+0j)
> 
> Proposed solution:
> 
> Use the textbook formula:
> def asinh(x):
>    return log(x+sqrt(x*x+1.0))
> 
> This calculation is more limited then the acosh calculation, but
> still works fine.

We're just using the VC++ C library.  I suggest you send your bug
report to Microsoft.

--Guido van Rossum (home page: http://www.python.org/~guido/)