summaryrefslogtreecommitdiff
path: root/lib/libm/tanf.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/tanf.c
parent4e2112e165fdd94dee58378e3ea32892f3710cd7 (diff)
feat: clang-tidy fixes
Diffstat (limited to 'lib/libm/tanf.c')
-rw-r--r--lib/libm/tanf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libm/tanf.c b/lib/libm/tanf.c
index 1007aa91..ef808637 100644
--- a/lib/libm/tanf.c
+++ b/lib/libm/tanf.c
@@ -14,7 +14,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __tandf, __rem_pio2f, FORCE_EVAL, GET_FLOAT_WORD
+
+#include <math.h> // for M_PI_2, tanf
+#include <stdint.h> // for uint32_t
/* Small multiples of pi/2 rounded to double precision. */
static const double t1pio2 = 1 * M_PI_2, /* 0x3FF921FB, 0x54442D18 */
@@ -26,7 +29,8 @@ float tanf(float x)
{
double y;
uint32_t ix;
- unsigned n, sign;
+ int n;
+ unsigned sign;
GET_FLOAT_WORD(ix, x);
sign = ix >> 31;
@@ -44,19 +48,17 @@ float tanf(float x)
if (ix <= 0x407b53d1) { /* |x| ~<= 5*pi/4 */
if (ix <= 0x4016cbe3) /* |x| ~<= 3pi/4 */
return __tandf((sign ? x + t1pio2 : x - t1pio2), 1);
- else
- return __tandf((sign ? x + t2pio2 : x - t2pio2), 0);
+ return __tandf((sign ? x + t2pio2 : x - t2pio2), 0);
}
if (ix <= 0x40e231d5) { /* |x| ~<= 9*pi/4 */
if (ix <= 0x40afeddf) /* |x| ~<= 7*pi/4 */
return __tandf((sign ? x + t3pio2 : x - t3pio2), 1);
- else
- return __tandf((sign ? x + t4pio2 : x - t4pio2), 0);
+ return __tandf((sign ? x + t4pio2 : x - t4pio2), 0);
}
/* tan(Inf or NaN) is NaN */
if (ix >= 0x7f800000)
- return x - x;
+ return NAN;
/* argument reduction */
n = __rem_pio2f(x, &y);