Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260731041110.GL27423@brightrain.aerifal.cx>
Date: Fri, 31 Jul 2026 00:11:10 -0400
From: Rich Felker <dalias@...c.org>
To: Damian McGuckin <damianm@....com.au>
Cc: musl@...ts.openwall.com, Paul Zimmermann <Paul.Zimmermann@...ia.fr>
Subject: Re: issue in acosh

On Fri, Jul 31, 2026 at 11:08:39AM +1000, Damian McGuckin wrote:
> On Thu, 30 Jul 2026, Rich Felker wrote:
> 
> > >         if (einf <= e || e < b ) /* x < 0 || x is a NaN || x == INF || x < 1 */
> > >         {
> > >             return x != x || x == INFINITY ? x + x : (x - x) / (x - x);
> > >         }
> > 
> > I don't think nan/inf need special treatment here. Just
> > 
> > 	if (e < 0x3ff) x = 0;
> > 
> > should make it work fine.
> 
> I do not quite understand.
> 
> Also, you need to treat -INFINITY different to +INFINITY.

The comment is already correct for -inf and +inf. You pass a negative
value to log() and get nan. You pass a +inf to log and get +inf.

The only case which is not already handled seems to be some numerical
instability around particular values. I need to (or someone needs to)
trace what happens when the failing argument is passed in, but
replacing any finite value <1 with 0 (my code above for that wasn't
quite right) should work to get the desired nan.

Rich

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.