|
|
Message-ID: <CACjHWf_2Gn089ZvR6PHYbsX_JFYcc0J4HGqgiHv4y0ksYEUOEA@mail.gmail.com>
Date: Fri, 28 Aug 2026 00:34:58 -0500
From: Alex A <splitterblue@...il.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] math: avoid four-way quadrant branch in atan2/atan2f
How about the cases as a table, keeping the (y,x) notation the file already
uses:
/* m: bit 0 is sign(y), bit 1 is sign(x).
(+,+) z (-,+) -z
(+,-) pi-(z-pi_lo) (-,-) (z-pi_lo)-pi
m&2 clear gives +-z, m&2 set gives +-(pi-(z-pi_lo)), sign from y. */
I'm happy either way if Rich has a preference.
On Fri, Aug 28, 2026 at 12:18 AM Damian McGuckin <damianm@....com.au> wrote:
> On Fri, 28 Aug 2026, Alex A wrote:
>
> > Thanks, I left it out since it stays in the history, but i can make the
> > comment give the mapping if that reads better:
> >
> > /* m: bit 0 is sign(y), bit 1 is sign(x). m&2 clear gives +-z,
> > m&2 set gives +-(pi - (z - pi_lo)), sign from y. */
>
> This is great and needs to be in there. But switch statement corresponds
> to how one would describe the quadrants mathematically so I would have the
> switch code in the comments as well.
>
> Thanks - Damian
Content of type "text/html" skipped
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.