diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-09 19:20:15 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-09 19:20:15 +0100 |
| commit | 885f5974cdf65b59415837ae97f5a14ef1350670 (patch) | |
| tree | 66ac13de29c7f4932c5fcae11773df574e4e256a /lib/libm/catanl.c | |
| parent | 8f9e448b2ef6db7cd905540c21f3c5b190e7a1e7 (diff) | |
feat: add gzip and new headers
Diffstat (limited to 'lib/libm/catanl.c')
| -rw-r--r-- | lib/libm/catanl.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/libm/catanl.c b/lib/libm/catanl.c new file mode 100644 index 00000000..949dc3d9 --- /dev/null +++ b/lib/libm/catanl.c @@ -0,0 +1,34 @@ +#include <float.h> +#include "__complex.h" + +long double complex catanl(long double complex z) +{ + long double complex w; + long double a, t, x, x2, y; + + x = creall(z); + y = cimagl(z); + + if ((x == 0.0L) && (y > 1.0L)) + goto overflow; + + x2 = x * x; + a = 1.0L - x2 - (y * y); + if (a == 0.0) + goto overflow; + + t = 0.5L * atan2l(2.0L * x, a); + w = redupil(t); + + t = y - 1.0L; + a = x2 + (t * t); + if (a == 0.0L) + goto overflow; + + t = y + 1.0L; + a = (x2 + (t * t)) / a; + return w + (0.25L * logl(a)) * I; + +overflow: + return LDBL_MAX + LDBL_MAX * I; +} |
