From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25035 invoked from network); 5 Jul 2022 14:41:42 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 5 Jul 2022 14:41:42 -0000 Received: (qmail 13708 invoked by uid 550); 5 Jul 2022 14:41:40 -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 8178 invoked from network); 5 Jul 2022 14:28:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1nnZ6oLC7hbkwXMnuMRsLAZdiOcWHeA/b2hkNjOhqWM=; b=mDLxxrfJr82O72tI6nLfFA45Z8aAhXl1cI56rtyySC0PVTG4Z3wYwWW7sWaahcDa9w YXSaKeMdOwoJ4VZBCJC9HFbFRBkCe2924QZ6hEUN8/O161dzXt2tsKAkbljtLNkcYcG9 tWeJj4bYISqqENgz3k2unYmkVaiEqwufkuorqXDGr7RMrqZR+YlfzU+3Tn+JbNOoYARX BnFIQYiYibMrXrbwJI60GqBcZMiip70cwtGU2HWBilBd5Kk8oicITODrnwLPYYlCpB/r xDY8TCCiZK9uLwwtzc/L0/yY+0WlXxlZjz9M14djwuHtI1Z5ZZkntMSAFq8eI0sXwTui nj/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=1nnZ6oLC7hbkwXMnuMRsLAZdiOcWHeA/b2hkNjOhqWM=; b=i4JOYX7nm230rQD7evKIOf14ghw4sOrRsUx4R9f9q3i6b1rxxBheXOjdoiDzhzDV/x QClDNzVUcpDmyTmEsO2fKjlegby8Y6CtGhixIz92YATH1hbu0NahK7ltL0Y1jbZaVhDr vScxE5ZFxhhNa/uL3Y5dHxdSkSwF4pXjSZYDNAfNlvePi/JxWH7Ki06WBVF++tZ4IDQ1 O4Q+uJk9AgEz6K2NFEK+pafHsc4+nHGs0hVyBRER+TJv3y+1H2fE7dZ9Xa939x08eQHL EP6TqX5qewoN+u0qQcmr+tvAujoQLFrwaCsNxRIY1zgMO3dUs6cq8lnHsLK212g8wmPP 9DLA== X-Gm-Message-State: AJIora9i0M5EIlx3/5J6UKWpnbSmUsrQZGrULhF4E2SNP8E5Ug2Ade6f BZsi+KCM5iHGgfahRhXVc+KsDXxqUZChUC9UzaE= X-Google-Smtp-Source: AGRyM1sqUW9HSmmcYS8v1WZbjrRo7ck+rhYI9haymuUQYwYFOkU9lXu+STjqiJXqeTdBqVsJO+bhZAMDTVKhAJRycks= X-Received: by 2002:a17:90a:f114:b0:1ef:991f:12e7 with SMTP id cc20-20020a17090af11400b001ef991f12e7mr4906073pjb.199.1657031323950; Tue, 05 Jul 2022 07:28:43 -0700 (PDT) MIME-Version: 1.0 References: <20220705093704.GY1320090@port70.net> In-Reply-To: <20220705093704.GY1320090@port70.net> From: Nikolaos Chatzikonstantinou Date: Tue, 5 Jul 2022 14:28:32 +0000 Message-ID: To: Nikolaos Chatzikonstantinou , musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [musl] Re: Implementing csqrtl() On Tue, Jul 5, 2022 at 9:37 AM Szabolcs Nagy wrote: > > * Nikolaos Chatzikonstantinou [2022-07-04 11:09:44 +0000]: > > > On Mon, Jul 4, 2022 at 9:35 AM Nikolaos Chatzikonstantinou > > wrote: > > > One of the missing complex functions is csqrtl(), the long double > > > version of complex square root. I was able to find a 1987 article from > > > W. Kahan, titled "Branch cuts for complex elementary functions." that > > > contained an implementation for complex square root for arbitrary > > > floating-point numbers. In this e-mail you'll find an attached git > > > patch with the implementation. > > > > I forgot to attach the patch, but here it is. > > this will need a description > and some testing. Yes, I agree.How should it be tested? > > + if ((isinf(x) || isinf(y)) && (isnan(r) || isinf(r))) { > > why do you need the && ? > can r be other than inf or nan? It's the case that x^2 + y^2 is inf for x,y finite. > > + k = logbl(fmaxl(fabsl(x), fabsl(y))); > > + x = scalbnl(x, -k); > > + y = scalbnl(y, -k); > > k is unsigned Good catch! I changed k to int and logbl to ilogbl. Regards, Nikolaos Chatzikonstantinou