From 169daa11155988a210fac949297381743f3cb400 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 9 Dec 2025 23:14:53 +0100 Subject: feat: clang-tidy fixes --- lib/libm/cosf.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'lib/libm/cosf.c') diff --git a/lib/libm/cosf.c b/lib/libm/cosf.c index d49dc0ac..f82b68de 100644 --- a/lib/libm/cosf.c +++ b/lib/libm/cosf.c @@ -14,7 +14,10 @@ * ==================================================== */ -#include "libm.h" +#include "libm.h" // for __sindf, __cosdf, __rem_pio2f, FORCE_EVAL, GET_F... + +#include // for M_PI_2, cosf +#include // for uint32_t /* Small multiples of pi/2 rounded to double precision. */ static const double c1pio2 = 1 * M_PI_2, /* 0x3FF921FB, 0x54442D18 */ @@ -43,22 +46,16 @@ float cosf(float x) if (ix <= 0x407b53d1) { /* |x| ~<= 5*pi/4 */ if (ix > 0x4016cbe3) /* |x| ~> 3*pi/4 */ return -__cosdf(sign ? x + c2pio2 : x - c2pio2); - else { - if (sign) - return __sindf(x + c1pio2); - else - return __sindf(c1pio2 - x); - } + if (sign) + return __sindf(x + c1pio2); + return __sindf(c1pio2 - x); } if (ix <= 0x40e231d5) { /* |x| ~<= 9*pi/4 */ if (ix > 0x40afeddf) /* |x| ~> 7*pi/4 */ return __cosdf(sign ? x + c4pio2 : x - c4pio2); - else { - if (sign) - return __sindf(-x - c3pio2); - else - return __sindf(x - c3pio2); - } + if (sign) + return __sindf(-x - c3pio2); + return __sindf(x - c3pio2); } /* cos(Inf or NaN) is NaN */ -- cgit v1.2.3