From: Rich Felker <dalias@libc.org>
To: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>
Cc: Markus Wichmann <nullplan@gmx.net>, musl@lists.openwall.com
Subject: Re: [musl] Re: Implementing csqrtl()
Date: Tue, 28 May 2024 21:38:14 -0400 [thread overview]
Message-ID: <20240529013813.GG10433@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAAQmekfGjOwy5s+P+E6kuUaMrOC02+tMigwN8fgUEhbixd2GYg@mail.gmail.com>
On Tue, Jul 05, 2022 at 04:14:13PM +0000, Nikolaos Chatzikonstantinou wrote:
> On Tue, Jul 5, 2022 at 3:35 PM Markus Wichmann <nullplan@gmx.net> wrote:
> >
> > On Tue, Jul 05, 2022 at 02:28:32PM +0000, Nikolaos Chatzikonstantinou wrote:
> > > 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]:
> > > >
> > > > > + 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.
> > >
> >
> > Yeah, but if x or y is infinite then so is r. So the entire part in
> > front of the && is redundant, because it is contained in the second
> > part.
> >
> > Unless I completely misunderstood how IEEE infinity works...
>
> Yes you are right, it should be if(isinf(x) || isinf(y)).
I don't think this is correct. It's possible for r (which actually
holds a value I would call r², perhaps r2 as var name?) to be infinite
even when x and y are finite. This sounds problematic. Don't you need
to work with actual r, guaranteed to be finite when x and y are, which
you could obtain from hypotl?
Rich
next prev parent reply other threads:[~2024-05-29 1:38 UTC|newest]
Thread overview: 13+ 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
2022-07-05 15:35 ` Markus Wichmann
2022-07-05 16:14 ` Nikolaos Chatzikonstantinou
2024-05-29 1:38 ` Rich Felker [this message]
2024-05-28 20:48 ` Nikolaos Chatzikonstantinou
2024-05-29 0:38 ` Gabriel Ravier
2024-05-29 1:34 ` Rich Felker
[not found] ` <CAAQmekdsDO=KuJ4CuVjTnTU8Baz3++LdUr=TeKJ4bcLTfJ+1gA@mail.gmail.com>
2024-05-29 12:59 ` Rich Felker
2024-05-29 15:13 ` James Y Knight
2024-05-31 15:37 ` Szabolcs Nagy
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=20240529013813.GG10433@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
--cc=nchatz314@gmail.com \
--cc=nullplan@gmx.net \
/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).