public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Complex division implementation: arbitrary sign taking?
@ 2021-04-07 17:48 Rosivaldo Fernandes Alves
  0 siblings, 0 replies; only message in thread
From: Rosivaldo Fernandes Alves @ 2021-04-07 17:48 UTC (permalink / raw)
  To: libc-help

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-07 17:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 17:48 Complex division implementation: arbitrary sign taking? Rosivaldo Fernandes Alves

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).