|
|
Message-ID: <2a413619-3367-591c-d3ee-5417656185a@esi.com.au> Date: Sat, 1 Aug 2026 08:55:28 +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 > > x + sqrt(x*x-1) > > I'm not even clear why the former form is preferred for > medium-magnitude positive x; At worst, it buys one extra bit of accuracy in the argument to log(). On average, it buys 3 bits extra. In terms of the result, the error drops from about 0.92ULP down to about 0.75ULP which I consider acceptable but a long way from correctly rounded if you need that. Then again, the computation for x in [1,2) which uses log1p() and is effectively log(x + sqrt(x*x-1)) which still has a 32-bit relative error of about 1.09ULP even if you use an FMA which is not so flash. I do not know how to get it significantly under 1*ULP although there are at least two approaches which yield a correctly rounded result (at a significant increase in complexity). 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.