Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANv4PNk1Tn_+Vam6G4pEEOV4PoiL7QRZHx7Pc01deqd2qr-02A@mail.gmail.com>
Date: Thu, 15 Aug 2024 09:18:19 -0400
From: Morten Welinder <mwelinder@...il.com>
To: musl@...ts.openwall.com
Subject: Re: catan(z)

atan2 definitely isn't supposed to always output rational numbers on
rational input.

atan2(+0,-1) is Pi.
atan2(-0,-1) is -Pi
atan2(1,1) is Pi/4 -- clearly not a rational number.

These aren't exactly rational results (unless you mean their
floating-point approximations).

M.

On Sun, Aug 11, 2024 at 11:56 PM Damian McGuckin <damianm@....com.au> wrote:
>
> On Mon, 12 Aug 2024, Damian McGuckin wrote:
>
> > There is some argument that if you handle the special cases at infinity
> > separately (which I think MUSL should do but I do not have time at the
> > moment), then one can assume that because pi/2 is irrational, then one
> > should never have to deal with the end points in the chunk of code where
> > those two lines of code seen above should appear. I will have a chat
> > sometime with the guy who wrote that logic in a WG14 paper when I get a
> > really clear head and can line him up.
>
> Consider
>
>         atan2(y, x)
>
> For any finite y and finite non-zero x floating point number arguments,
> i.e. rational numbers, the result of atan2(y, x) must be rational and so
> is never +/- pi (which is irrational and only occurs when the ration y/x
> is a mathematical infinity, not an overflowing infinity). So, we can
> ignore the endpoints as long as our special case handling takes care of
> the case of zero x.
>
> I think that is correct .... or is my brain still not working properly
> after too many late nights watching the Olympics.
>
> 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.