From e1b57ede3ecad17e8f3c4e59f7fb0df1d5a6b2f4 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 15 Aug 2024 10:07:36 -0400 Subject: catan: remove no-op reduction mod pi and unused code the output of atan2 is already in the correct range and does not need further reduction. the MAXNUM macros were both unused and incorrect. --- src/complex/catan.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'src/complex/catan.c') diff --git a/src/complex/catan.c b/src/complex/catan.c index ccc2fb53..b4fe552a 100644 --- a/src/complex/catan.c +++ b/src/complex/catan.c @@ -60,29 +60,6 @@ #include "complex_impl.h" -#define MAXNUM 1.0e308 - -static const double DP1 = 3.14159265160560607910E0; -static const double DP2 = 1.98418714791870343106E-9; -static const double DP3 = 1.14423774522196636802E-17; - -static double _redupi(double x) -{ - double t; - long i; - - t = x/M_PI; - if (t >= 0.0) - t += 0.5; - else - t -= 0.5; - - i = t; /* the multiple */ - t = i; - t = ((x - t * DP1) - t * DP2) - t * DP3; - return t; -} - double complex catan(double complex z) { double complex w; @@ -95,7 +72,7 @@ double complex catan(double complex z) a = 1.0 - x2 - (y * y); t = 0.5 * atan2(2.0 * x, a); - w = _redupi(t); + w = t; t = y - 1.0; a = x2 + (t * t); -- cgit v1.2.1