From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 4AE482A4F0 for ; Mon, 12 Aug 2024 05:40:02 +0200 (CEST) Received: (qmail 30617 invoked by uid 550); 12 Aug 2024 03:39:56 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 30577 invoked from network); 12 Aug 2024 03:39:56 -0000 Date: Mon, 12 Aug 2024 13:39:44 +1000 (AEST) From: Damian McGuckin To: MUSL In-Reply-To: <20240811200812.GZ3766212@port70.net> Message-ID: <7e9463-98a3-4b2-c10-e3fbf79a6b8@esi.com.au> References: <21ca5c9-b1e-71b5-87b-a37f81f691ab@esi.com.au> <20240811200812.GZ3766212@port70.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Subject: Re: [musl] catan(z) On Sun, 11 Aug 2024, Szabolcs Nagy wrote: > * Damian McGuckin [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