```Message-ID: <7e9463-98a3-4b2-c10-e3fbf79a6b8@esi.com.au>
Date: Mon, 12 Aug 2024 13:39:44 +1000 (AEST)
From: Damian McGuckin <damianm@....com.au>
To: MUSL <musl@...ts.openwall.com>
Subject: Re: catan(z)

On Sun, 11 Aug 2024, Szabolcs Nagy wrote:

> * Damian McGuckin <damianm@....com.au> [2024-08-12 00:01:01 +1000]:
>>
>> In this routine, there are 2 lines of code
>>
>>     t = 0.5 * atan2(2.0 * x, a);
>>     w = _redupi(t);
>>
>> The first computes atan2() which returns a number in the range [-pi,+pi]
>> which means that t is a number in the range [-pi/2,+pi/2].
>>
>> As far as I understand, the routine _redupi(t) accepts a argument and
>> reduces it into the range [-pi, +pi]. Am I mistaken?
>
> *reduces into [-pi/2, pi/2]

Yes. Silly me. Why? Because ...

atan2() returns a number in [-pi, +pi], 't' is in [-pi/2,+pi/2],

hence, at least in this case, _redupi(t) just maps that 't' into
that same range.

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.

Thanks - Damian
```

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