summaryrefslogtreecommitdiff
path: root/lib/libm/tanl.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-09 23:14:53 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-09 23:14:53 +0100
commit169daa11155988a210fac949297381743f3cb400 (patch)
tree602ef5df5ae9ea075ab3d5dac3c8ad60da1ea2cc /lib/libm/tanl.c
parent4e2112e165fdd94dee58378e3ea32892f3710cd7 (diff)
feat: clang-tidy fixes
Diffstat (limited to 'lib/libm/tanl.c')
-rw-r--r--lib/libm/tanl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libm/tanl.c b/lib/libm/tanl.c
index c8c0984b..22657cce 100644
--- a/lib/libm/tanl.c
+++ b/lib/libm/tanl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), __tanl, __rem_pio2l
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for tanl, M_PI_4
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double tanl(long double x)
@@ -14,7 +17,8 @@ long double tanl(long double x)
u.i.se &= 0x7fff;
if (u.i.se == 0x7fff)
- return x - x;
+ return NAN;
+
if (u.f < M_PI_4) {
if (u.i.se < 0x3fff - LDBL_MANT_DIG / 2) {
/* raise inexact if x!=0 and underflow if subnormal */
@@ -24,6 +28,6 @@ long double tanl(long double x)
return __tanl(x, 0, 0);
}
n = __rem_pio2l(x, y);
- return __tanl(y[0], y[1], n & 1);
+ return __tanl(y[0], y[1], (int)(n & 1));
}
#endif