summaryrefslogtreecommitdiff
path: root/src/complex/catan.c
diff options
context:
space:
mode:
authorRich Felker <[email protected]>2024-08-15 10:07:36 -0400
committerRich Felker <[email protected]>2024-08-16 11:51:53 -0400
commite1b57ede3ecad17e8f3c4e59f7fb0df1d5a6b2f4 (patch)
tree9991d9b7a2c02f2ddc5108842631a89ed0791cc6 /src/complex/catan.c
parentca4e632df42a41aaaf9445a0cfaa939d50a565b8 (diff)
downloadmusl-e1b57ede3ecad17e8f3c4e59f7fb0df1d5a6b2f4.tar.gz
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.
Diffstat (limited to 'src/complex/catan.c')
-rw-r--r--src/complex/catan.c25
1 files changed, 1 insertions, 24 deletions
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);