Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc6f1778-1281-e9e4-31f8-3abb39e6b7e8@esi.com.au>
Date: Fri, 31 Jul 2026 17:39:45 +1000 (AEST)
From: Damian McGuckin <damianm@....com.au>
To: musl@...ts.openwall.com
cc: Paul Zimmermann <Paul.Zimmermann@...ia.fr>
Subject: Re: issue in acosh

On Fri, 31 Jul 2026, Rich Felker wrote:

> The problem looks to be that, when x is negative,
>
>    2*x - 1/(x+sqrt(x*x-1))
>
> is a very inaccurate way of computing the desired value

As far as I can tell looking at old implementations of acosh(x), that this 
approximation was never visited for x is negative because an x is 
negative case was handled earlier in the routines.

 	I'm not even clear why the former form is preferred for
 	medium-magnitude positive x; it doesn't seem to be avoiding any
 	overflow or cancellation problems.

At the risk of oversimplifying it, I think because the error in the term

 	1/(x + sqrt(x * x - 1))

relative to 2 * x is smaller (in an overall sense) than the error in the 
term

 	sqrt(x * x - 1)

relative to x.

That said, one newer implementation seeks better accuracy and instead 
breaks the domain [2..128] into multiple segments and then approximates 
each with a minimax polynomial. Scary stuff.  AMD's AOCL.

Another by Sibidanov does something similar but it is really scary stuff 
and I am eagerly awaiting the documentation because I cannot understand 
much of it. Maybe with documentation I won't understand much more. GLIBC.

Thanks - Damian

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.