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=-2.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 B5676281F4 for ; Tue, 28 May 2024 22:51:05 +0200 (CEST) Received: (qmail 7209 invoked by uid 550); 28 May 2024 20:51:00 -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 1274 invoked from network); 28 May 2024 20:48:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716929315; x=1717534115; darn=lists.openwall.com; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aw9I7Ih7q5S8cQ54+WxiRD4Qv2J+0NfTSXF9+epM/24=; b=cM0xQx995COXjig9VPvjEX4kg9F0bpcTZcFRp+D2dbiZB3xOTLEmG3Y9jCUc+4Mx7q G/ZC+VUI0YCa9gnxQssy+XopCLiTJvWWEA3hhg0joCw2p5YgBCD18DhjEJ287xZWC5h3 8JjvrzkHxAZcBFYbVZg86KZrhc9GlLoaol8LyBk6Np+ZxnxjxbGrggwYH8AZbeWiX7CJ uZ/LmBnO18cyUodabbdyNK2/k04jMyewe/TSldik9TxSvRSnbXllddKyxDYppKL8D1zZ xWu9Os8rGQx8LiWu4g/15XBiNBCicYktGZX0t8uzyoi1X1on1HX4en2aDB6fHItZJtmP QotA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716929315; x=1717534115; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aw9I7Ih7q5S8cQ54+WxiRD4Qv2J+0NfTSXF9+epM/24=; b=ITcy30D4p/GKKtnV5SBUE2MuXNuM3QN9wmQzMKL3o4LvLU7ECoyUPAT9VVwIETiQcL E+tlL2wLji8Q9nVrijO1qtUMg9WzYNEiv19J46jvUESA9wjd5OUIbQoxOjFROFBH94J7 01Vfx9QnNAnfeOl6ypEsCa7ABQVVJTFvrPHc4Gr0DGjPHxlyHLeQXzPflzfP4VzeyFQq HS09LfBrjzunbxJq2B4dugslR7mXMIdurlZjp3+5v/RBbjhfp+/R3JeTqo8BQ7ms5ehd CYmeHKhDb55BQlADtpZSoBCv+KxanZmhDNJX7Oavsy2msWjVydQ0GXzm/4+gF7JCJLI1 oKUw== X-Gm-Message-State: AOJu0YxKU8n35Vq6sB4QoYpMiu7AkYHf387XZ1OjBUD1j4rtWje/6+Bp FHJ9RgZDiD/2FzrayYSxgZA6+7TOhGoeSg7REPk6TrkJpkD3cJ4Q2YoexgM/clzMmoUJI4AmG+O JctR+VJUqk1aiWgbi1bZHXMhBwP2GcZ51 X-Google-Smtp-Source: AGHT+IEVwD7POxdaxiijUXeqfk/te5+IHnyWxA3Q+WLx4fsIeSXSv2dkeBtDgm00Umb4+UphvEMoe5RtkgnP4urtfRU= X-Received: by 2002:a81:8447:0:b0:627:e3a5:1884 with SMTP id 00721157ae682-62a08d79bffmr132459047b3.12.1716929314758; Tue, 28 May 2024 13:48:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nikolaos Chatzikonstantinou Date: Tue, 28 May 2024 16:48:23 -0400 Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [musl] Re: Implementing csqrtl() On Mon, Jul 4, 2022 at 5:35=E2=80=AFAM Nikolaos Chatzikonstantinou wrote: > > Hello list, > > I wanted to implement some function from > > which is an open issue in the wiki. > > 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. > > As a very basic test, I wrote a program that produces random > complex numbers in the square [0, N] x [0, N] for N=3D1,100 and > calculates csqrt{,f,l}() with my implementation, glibc and the > arbitrary precision mpc_sqrt() from MPC, > . > > Glibc stays almost within 1 ulp in float and double, but my > implementation wasn't so good with float. The double > implementation seems to get the exact same results as glibc does. > > I was not able to even test the long double version with this > method, because I did not write the code that produces random > long double complex numbers yet. > > There's a few things that I don't quite understand here. One is, I'm > not sure why Kahan's implementation is accurate. For another, I don't > know how to do any sort of speed tests; I've read online that > microbenchmarking is not reproducible for math functions, and so > google's benchmark does not seem > to help. Of course I'm aware that the C implementation would not be > the one used in most systems, as the assembly implementations are > usually better. Finally, I don't know what the right way to test an > implementation for accuracy is: whether by using automation or writing > proofs. It seems the state of the art has evolved quite a bit from > 1987, and yet I don't know where to look for information on this > topic, as it seems very specific to chips & the C std lib. > > Feel free to provide any sort of criticism. I'm e-mailing this > implementation for the purpose of starting a discussion, but I'm > hoping to be able to contribute something in the near future. Hello, I want to revive the discussion on this message. Last time I attached the patch I was ignored, apart from some nitpicks on the C source in the patch, which was a draft anyway. Missing complex math functions are still an open issue. I can't help but think that last time I was ignored apart from some nitpick on some signed/unsigned type, as if getting schooled on C is the purpose of the mailing list -- bizarre! the patch was a draft to start a discussion on resolving the complex math issue. What I concluded from the responses I received is that the musl project does not have a maintainer who is capable of understanding the underlying issues with the complex math algorithms in libc. Is that still the case and is there any interest in resolving it perhaps by finding a maintainer who can work on this issue? Regards, Nikolaos Chatzikonstantinou