Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAQmekf1XKw+_nQe9M7YD_5VYWBcVTEgekYK8JEk18D5ugLhgg@mail.gmail.com>
Date: Tue, 5 Jul 2022 14:28:32 +0000
From: Nikolaos Chatzikonstantinou <nchatz314@...il.com>
To: Nikolaos Chatzikonstantinou <nchatz314@...il.com>, musl@...ts.openwall.com
Subject: Re: Re: Implementing csqrtl()

On Tue, Jul 5, 2022 at 9:37 AM Szabolcs Nagy <nsz@...t70.net> wrote:
>
> * Nikolaos Chatzikonstantinou <nchatz314@...il.com> [2022-07-04 11:09:44 +0000]:
>
> > On Mon, Jul 4, 2022 at 9:35 AM Nikolaos Chatzikonstantinou
> > <nchatz314@...il.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

Powered by blists - more mailing lists

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