public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Rosivaldo Fernandes Alves <rosivaldo.fa@gmail.com>
To: libc-help@sourceware.org
Subject: Complex division implementation: arbitrary sign taking?
Date: Wed, 7 Apr 2021 14:48:02 -0300	[thread overview]
Message-ID: <c1937d79-d631-ae50-c74e-09cf2ece7918@gmail.com> (raw)

While trying to figure out how glibc implements complex division, I've 
found divtc3.c, where a division by zero is handled like written below.

       if (denom == 0.0 && (!isnan (a) || !isnan (b)))
	{
	  x = copysignl (INFINITY, c) * a;
	  y = copysignl (INFINITY, c) * b;
	}

The other branches of the algorithm handle signs in a very sensible 
manner, but the lines above seem rather arbitrary. Why to take the sign 
of c for both parts? Why does d play not part at all?

Thanks in advance.

Rosivaldo.

                 reply	other threads:[~2021-04-07 17:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=c1937d79-d631-ae50-c74e-09cf2ece7918@gmail.com \
    --to=rosivaldo.fa@gmail.com \
    --cc=libc-help@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).