public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Delete check in catan, catanf, and catanl functions.
@ 2023-10-10 19:19 Jeff Johnston
  0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2023-10-10 19:19 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=dcb2b7d7b8456827d4cd82b5798526e7cd483e36

commit dcb2b7d7b8456827d4cd82b5798526e7cd483e36
Author: Joseph Faulls <Joseph.Faulls@imgtec.com>
Date:   Tue Oct 10 15:12:00 2023 -0400

    Delete check in catan, catanf, and catanl functions.
    
    The check incorrectly results in catan returning nan + inf i when real part is +/- 1 and
    imaginary part is 0.  The same occurs for real 0.8 and imaginary 0.6.
    
    The change ends up matching glibc behaviour.

Diff:
---
 newlib/libm/complex/catan.c  | 2 --
 newlib/libm/complex/catanf.c | 2 --
 newlib/libm/complex/catanl.c | 2 --
 3 files changed, 6 deletions(-)

diff --git a/newlib/libm/complex/catan.c b/newlib/libm/complex/catan.c
index 77510ec2f..34d75b849 100644
--- a/newlib/libm/complex/catan.c
+++ b/newlib/libm/complex/catan.c
@@ -105,8 +105,6 @@ catan(double complex z)
 
 	x2 = x * x;
 	a = 1.0 - x2 - (y * y);
-	if (a == 0.0)
-		goto ovrf;
 
 	t = 0.5 * atan2(2.0 * x, a);
 	w = _redupi(t);
diff --git a/newlib/libm/complex/catanf.c b/newlib/libm/complex/catanf.c
index ac1a65c08..9dc2fb23f 100644
--- a/newlib/libm/complex/catanf.c
+++ b/newlib/libm/complex/catanf.c
@@ -54,8 +54,6 @@ catanf(float complex z)
 
 	x2 = x * x;
 	a = 1.0f - x2 - (y * y);
-	if (a == 0.0f)
-		goto ovrf;
 
 	t = 0.5f * atan2f(2.0f * x, a);
 	w = _redupif(t);
diff --git a/newlib/libm/complex/catanl.c b/newlib/libm/complex/catanl.c
index ee2a25930..13839ac73 100644
--- a/newlib/libm/complex/catanl.c
+++ b/newlib/libm/complex/catanl.c
@@ -51,8 +51,6 @@ catanl(long double complex z)
 
 	x2 = x * x;
 	a = 1.0L - x2 - (y * y);
-	if (a == 0.0)
-		goto ovrf;
 
 	t = 0.5L * atan2l(2.0L * x, a);
 	w = _redupil(t);

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

only message in thread, other threads:[~2023-10-10 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 19:19 [newlib-cygwin] Delete check in catan, catanf, and catanl functions Jeff Johnston

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