From: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>
To: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>,
musl@lists.openwall.com
Subject: Re: [musl] Re: Implementing csqrtl()
Date: Tue, 5 Jul 2022 14:28:32 +0000 [thread overview]
Message-ID: <CAAQmekf1XKw+_nQe9M7YD_5VYWBcVTEgekYK8JEk18D5ugLhgg@mail.gmail.com> (raw)
In-Reply-To: <20220705093704.GY1320090@port70.net>
On Tue, Jul 5, 2022 at 9:37 AM Szabolcs Nagy <nsz@port70.net> wrote:
>
> * Nikolaos Chatzikonstantinou <nchatz314@gmail.com> [2022-07-04 11:09:44 +0000]:
>
> > On Mon, Jul 4, 2022 at 9:35 AM Nikolaos Chatzikonstantinou
> > <nchatz314@gmail.com> 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
next prev parent reply other threads:[~2022-07-05 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 9:35 [musl] " Nikolaos Chatzikonstantinou
2022-07-04 11:09 ` [musl] " Nikolaos Chatzikonstantinou
2022-07-05 9:37 ` Szabolcs Nagy
2022-07-05 14:28 ` Nikolaos Chatzikonstantinou [this message]
2022-07-05 15:35 ` Markus Wichmann
2022-07-05 16:14 ` Nikolaos Chatzikonstantinou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAQmekf1XKw+_nQe9M7YD_5VYWBcVTEgekYK8JEk18D5ugLhgg@mail.gmail.com \
--to=nchatz314@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).