summaryrefslogtreecommitdiff
path: root/lib/libm
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
parent4e2112e165fdd94dee58378e3ea32892f3710cd7 (diff)
feat: clang-tidy fixes
Diffstat (limited to 'lib/libm')
-rw-r--r--lib/libm/__complex.h3
-rw-r--r--lib/libm/__cos.c4
-rw-r--r--lib/libm/__cosdf.c4
-rw-r--r--lib/libm/__cosl.c13
-rw-r--r--lib/libm/__expo2.c5
-rw-r--r--lib/libm/__expo2f.c5
-rw-r--r--lib/libm/__fpclassify.c4
-rw-r--r--lib/libm/__fpclassifyf.c4
-rw-r--r--lib/libm/__fpclassifyl.c5
-rw-r--r--lib/libm/__invtrigl.c3
-rw-r--r--lib/libm/__math_divzero.c4
-rw-r--r--lib/libm/__math_divzerof.c4
-rw-r--r--lib/libm/__math_invalid.c2
-rw-r--r--lib/libm/__math_invalidf.c2
-rw-r--r--lib/libm/__math_invalidl.c5
-rw-r--r--lib/libm/__math_oflow.c4
-rw-r--r--lib/libm/__math_oflowf.c4
-rw-r--r--lib/libm/__math_uflow.c4
-rw-r--r--lib/libm/__math_uflowf.c4
-rw-r--r--lib/libm/__math_xflow.c4
-rw-r--r--lib/libm/__math_xflowf.c4
-rw-r--r--lib/libm/__polevll.c4
-rw-r--r--lib/libm/__rem_pio2.c72
-rw-r--r--lib/libm/__rem_pio2_large.c6
-rw-r--r--lib/libm/__rem_pio2f.c6
-rw-r--r--lib/libm/__rem_pio2l.c11
-rw-r--r--lib/libm/__signbit.c2
-rw-r--r--lib/libm/__signbitf.c2
-rw-r--r--lib/libm/__signbitl.c4
-rw-r--r--lib/libm/__sin.c7
-rw-r--r--lib/libm/__sindf.c4
-rw-r--r--lib/libm/__sinl.c10
-rw-r--r--lib/libm/__tan.c5
-rw-r--r--lib/libm/__tandf.c4
-rw-r--r--lib/libm/__tanl.c25
-rw-r--r--lib/libm/acos.c5
-rw-r--r--lib/libm/acosf.c5
-rw-r--r--lib/libm/acosh.c4
-rw-r--r--lib/libm/acoshf.c4
-rw-r--r--lib/libm/acoshl.c5
-rw-r--r--lib/libm/acosl.c10
-rw-r--r--lib/libm/asin.c5
-rw-r--r--lib/libm/asinf.c7
-rw-r--r--lib/libm/asinh.c5
-rw-r--r--lib/libm/asinhf.c5
-rw-r--r--lib/libm/asinhl.c5
-rw-r--r--lib/libm/asinl.c12
-rw-r--r--lib/libm/atan.c5
-rw-r--r--lib/libm/atan2.c5
-rw-r--r--lib/libm/atan2f.c5
-rw-r--r--lib/libm/atan2l.c7
-rw-r--r--lib/libm/atanf.c5
-rw-r--r--lib/libm/atanh.c5
-rw-r--r--lib/libm/atanhf.c5
-rw-r--r--lib/libm/atanhl.c5
-rw-r--r--lib/libm/atanl.c7
-rw-r--r--lib/libm/cabs.c4
-rw-r--r--lib/libm/cabsf.c4
-rw-r--r--lib/libm/cabsl.c4
-rw-r--r--lib/libm/cacos.c4
-rw-r--r--lib/libm/cacosf.c4
-rw-r--r--lib/libm/cacosh.c2
-rw-r--r--lib/libm/cacoshf.c2
-rw-r--r--lib/libm/cacoshl.c2
-rw-r--r--lib/libm/cacosl.c4
-rw-r--r--lib/libm/carg.c4
-rw-r--r--lib/libm/cargf.c4
-rw-r--r--lib/libm/cargl.c4
-rw-r--r--lib/libm/casin.c2
-rw-r--r--lib/libm/casinf.c2
-rw-r--r--lib/libm/casinh.c2
-rw-r--r--lib/libm/casinhf.c2
-rw-r--r--lib/libm/casinhl.c2
-rw-r--r--lib/libm/casinl.c2
-rw-r--r--lib/libm/catan.c7
-rw-r--r--lib/libm/catanf.c7
-rw-r--r--lib/libm/catanh.c2
-rw-r--r--lib/libm/catanhf.c2
-rw-r--r--lib/libm/catanhl.c2
-rw-r--r--lib/libm/catanl.c7
-rw-r--r--lib/libm/cbrt.c4
-rw-r--r--lib/libm/cbrtf.c4
-rw-r--r--lib/libm/cbrtl.c6
-rw-r--r--lib/libm/ccos.c7
-rw-r--r--lib/libm/ccosf.c5
-rw-r--r--lib/libm/ccosh.c4
-rw-r--r--lib/libm/ccoshf.c4
-rw-r--r--lib/libm/ccoshl.c4
-rw-r--r--lib/libm/ccosl.c5
-rw-r--r--lib/libm/ceil.c6
-rw-r--r--lib/libm/ceilf.c5
-rw-r--r--lib/libm/ceill.c5
-rw-r--r--lib/libm/cexp.c4
-rw-r--r--lib/libm/cexpl.c4
-rw-r--r--lib/libm/cexprf.c4
-rw-r--r--lib/libm/cimag.c5
-rw-r--r--lib/libm/cimagf.c4
-rw-r--r--lib/libm/cimagl.c4
-rw-r--r--lib/libm/clog.c3
-rw-r--r--lib/libm/clog10.c6
-rw-r--r--lib/libm/clog10f.c5
-rw-r--r--lib/libm/clog10l.c3
-rw-r--r--lib/libm/clogf.c3
-rw-r--r--lib/libm/clogl.c3
-rw-r--r--lib/libm/conj.c4
-rw-r--r--lib/libm/conjf.c4
-rw-r--r--lib/libm/conjl.c4
-rw-r--r--lib/libm/copysign.c3
-rw-r--r--lib/libm/copysignf.c4
-rw-r--r--lib/libm/copysignl.c5
-rw-r--r--lib/libm/cos.c5
-rw-r--r--lib/libm/cosf.c23
-rw-r--r--lib/libm/cosh.c5
-rw-r--r--lib/libm/coshf.c5
-rw-r--r--lib/libm/coshl.c6
-rw-r--r--lib/libm/cosl.c5
-rw-r--r--lib/libm/cpow.c3
-rw-r--r--lib/libm/cpowf.c3
-rw-r--r--lib/libm/cpowl.c3
-rw-r--r--lib/libm/cproj.c5
-rw-r--r--lib/libm/cprojl.c5
-rw-r--r--lib/libm/creal.c4
-rw-r--r--lib/libm/crealf.c4
-rw-r--r--lib/libm/creall.c4
-rw-r--r--lib/libm/csin.c5
-rw-r--r--lib/libm/csinf.c5
-rw-r--r--lib/libm/csinh.c3
-rw-r--r--lib/libm/csinhf.c3
-rw-r--r--lib/libm/csinhl.c3
-rw-r--r--lib/libm/csinl.c5
-rw-r--r--lib/libm/csqrt.c23
-rw-r--r--lib/libm/csqrtf.c15
-rw-r--r--lib/libm/csqrtl.c13
-rw-r--r--lib/libm/ctan.c5
-rw-r--r--lib/libm/ctanf.c5
-rw-r--r--lib/libm/ctanh.c4
-rw-r--r--lib/libm/ctanhf.c4
-rw-r--r--lib/libm/ctanhl.c4
-rw-r--r--lib/libm/ctanl.c5
-rw-r--r--lib/libm/erf.c5
-rw-r--r--lib/libm/erff.c5
-rw-r--r--lib/libm/erfl.c6
-rw-r--r--lib/libm/exp.c12
-rw-r--r--lib/libm/exp10.c6
-rw-r--r--lib/libm/exp10f.c6
-rw-r--r--lib/libm/exp10l.c7
-rw-r--r--lib/libm/exp2.c11
-rw-r--r--lib/libm/exp2f.c9
-rw-r--r--lib/libm/exp2f_data.h2
-rw-r--r--lib/libm/exp2l.c6
-rw-r--r--lib/libm/exp_data.h2
-rw-r--r--lib/libm/expf.c9
-rw-r--r--lib/libm/expl.c5
-rw-r--r--lib/libm/expm1.c5
-rw-r--r--lib/libm/expm1f.c5
-rw-r--r--lib/libm/expm1l.c3
-rw-r--r--lib/libm/fabs.c4
-rw-r--r--lib/libm/fabsf.c4
-rw-r--r--lib/libm/fabsl.c5
-rw-r--r--lib/libm/fdim.c2
-rw-r--r--lib/libm/fdimf.c2
-rw-r--r--lib/libm/fdiml.c4
-rw-r--r--lib/libm/finite.c2
-rw-r--r--lib/libm/finitef.c2
-rw-r--r--lib/libm/floor.c6
-rw-r--r--lib/libm/floorf.c5
-rw-r--r--lib/libm/floorl.c5
-rw-r--r--lib/libm/fma.c41
-rw-r--r--lib/libm/fmaf.c7
-rw-r--r--lib/libm/fmal.c12
-rw-r--r--lib/libm/fmax.c2
-rw-r--r--lib/libm/fmaxf.c2
-rw-r--r--lib/libm/fmaxl.c4
-rw-r--r--lib/libm/fmin.c2
-rw-r--r--lib/libm/fminf.c2
-rw-r--r--lib/libm/fminl.c4
-rw-r--r--lib/libm/fmod.c4
-rw-r--r--lib/libm/fmodf.c4
-rw-r--r--lib/libm/fmodl.c6
-rw-r--r--lib/libm/frexp.c7
-rw-r--r--lib/libm/frexpf.c7
-rw-r--r--lib/libm/frexpl.c8
-rw-r--r--lib/libm/hypot.c6
-rw-r--r--lib/libm/hypotf.c4
-rw-r--r--lib/libm/hypotl.c5
-rw-r--r--lib/libm/ilogb.c7
-rw-r--r--lib/libm/ilogbf.c7
-rw-r--r--lib/libm/ilogbl.c8
-rw-r--r--lib/libm/j0.c5
-rw-r--r--lib/libm/j0f.c5
-rw-r--r--lib/libm/j1.c5
-rw-r--r--lib/libm/j1f.c5
-rw-r--r--lib/libm/jn.c5
-rw-r--r--lib/libm/ldexp.c2
-rw-r--r--lib/libm/ldexpf.c2
-rw-r--r--lib/libm/ldexpl.c2
-rw-r--r--lib/libm/lgamma.c5
-rw-r--r--lib/libm/lgamma_r.c5
-rw-r--r--lib/libm/lgammaf.c5
-rw-r--r--lib/libm/lgammaf_r.c5
-rw-r--r--lib/libm/lgammal.c6
-rw-r--r--lib/libm/libm.abin1215786 -> 1175300 bytes
-rw-r--r--lib/libm/libm.h4
-rw-r--r--lib/libm/llrint.c2
-rw-r--r--lib/libm/llrintf.c2
-rw-r--r--lib/libm/llrintl.c9
-rw-r--r--lib/libm/llround.c2
-rw-r--r--lib/libm/llroundf.c2
-rw-r--r--lib/libm/llroundl.c2
-rw-r--r--lib/libm/log.c9
-rw-r--r--lib/libm/log10.c4
-rw-r--r--lib/libm/log10f.c4
-rw-r--r--lib/libm/log10l.c9
-rw-r--r--lib/libm/log1p.c5
-rw-r--r--lib/libm/log1pf.c5
-rw-r--r--lib/libm/log1pl.c5
-rw-r--r--lib/libm/log2.c9
-rw-r--r--lib/libm/log2f.c9
-rw-r--r--lib/libm/log2l.c5
-rw-r--r--lib/libm/logb.c2
-rw-r--r--lib/libm/logbf.c2
-rw-r--r--lib/libm/logbl.c2
-rw-r--r--lib/libm/logf.c9
-rw-r--r--lib/libm/logl.c5
-rw-r--r--lib/libm/lrint.c7
-rw-r--r--lib/libm/lrintf.c2
-rw-r--r--lib/libm/lrintl.c9
-rw-r--r--lib/libm/lround.c2
-rw-r--r--lib/libm/lroundf.c2
-rw-r--r--lib/libm/lroundl.c2
-rw-r--r--lib/libm/modf.c3
-rw-r--r--lib/libm/modff.c3
-rw-r--r--lib/libm/modfl.c5
-rw-r--r--lib/libm/nan.c4
-rw-r--r--lib/libm/nanf.c4
-rw-r--r--lib/libm/nanl.c4
-rw-r--r--lib/libm/nearbyint.c6
-rw-r--r--lib/libm/nearbyintf.c6
-rw-r--r--lib/libm/nearbyintl.c9
-rw-r--r--lib/libm/nextafter.c5
-rw-r--r--lib/libm/nextafterf.c5
-rw-r--r--lib/libm/nextafterl.c5
-rw-r--r--lib/libm/nexttoward.c6
-rw-r--r--lib/libm/nexttowardf.c5
-rw-r--r--lib/libm/nexttowardl.c2
-rw-r--r--lib/libm/pow.c17
-rw-r--r--lib/libm/powf.c11
-rw-r--r--lib/libm/powf_data.h3
-rw-r--r--lib/libm/powl.c5
-rw-r--r--lib/libm/projf.c5
-rw-r--r--lib/libm/remainder.c4
-rw-r--r--lib/libm/remainderf.c4
-rw-r--r--lib/libm/remainderl.c4
-rw-r--r--lib/libm/remquo.c4
-rw-r--r--lib/libm/remquof.c4
-rw-r--r--lib/libm/remquol.c6
-rw-r--r--lib/libm/rint.c6
-rw-r--r--lib/libm/rintf.c6
-rw-r--r--lib/libm/rintl.c5
-rw-r--r--lib/libm/round.c6
-rw-r--r--lib/libm/roundf.c6
-rw-r--r--lib/libm/roundl.c5
-rw-r--r--lib/libm/scalb.c5
-rw-r--r--lib/libm/scalbf.c5
-rw-r--r--lib/libm/scalbln.c4
-rw-r--r--lib/libm/scalblnf.c4
-rw-r--r--lib/libm/scalblnl.c6
-rw-r--r--lib/libm/scalbn.c4
-rw-r--r--lib/libm/scalbnf.c4
-rw-r--r--lib/libm/scalbnl.c5
-rw-r--r--lib/libm/signgam.c5
-rw-r--r--lib/libm/significand.c2
-rw-r--r--lib/libm/significandf.c2
-rw-r--r--lib/libm/sin.c5
-rw-r--r--lib/libm/sincos.c4
-rw-r--r--lib/libm/sincosf.c5
-rw-r--r--lib/libm/sincosl.c6
-rw-r--r--lib/libm/sinf.c11
-rw-r--r--lib/libm/sinh.c5
-rw-r--r--lib/libm/sinhf.c5
-rw-r--r--lib/libm/sinhl.c5
-rw-r--r--lib/libm/sinl.c5
-rw-r--r--lib/libm/sqrt.c9
-rw-r--r--lib/libm/sqrt_data.c3
-rw-r--r--lib/libm/sqrt_data.h2
-rw-r--r--lib/libm/sqrtf.c9
-rw-r--r--lib/libm/sqrtl.c11
-rw-r--r--lib/libm/tan.c5
-rw-r--r--lib/libm/tanf.c16
-rw-r--r--lib/libm/tanh.c7
-rw-r--r--lib/libm/tanhf.c7
-rw-r--r--lib/libm/tanhl.c6
-rw-r--r--lib/libm/tanl.c10
-rw-r--r--lib/libm/tgamma.c13
-rw-r--r--lib/libm/tgammaf.c4
-rw-r--r--lib/libm/tgammal.c7
-rw-r--r--lib/libm/trunc.c5
-rw-r--r--lib/libm/truncf.c5
-rw-r--r--lib/libm/truncl.c5
299 files changed, 1057 insertions, 587 deletions
diff --git a/lib/libm/__complex.h b/lib/libm/__complex.h
index 2c54d1e9..21b07c74 100644
--- a/lib/libm/__complex.h
+++ b/lib/libm/__complex.h
@@ -1,9 +1,8 @@
#ifndef __LIBC_COMPLEX_H__
#define __LIBC_COMPLEX_H__
-#include <sys/cdefs.h>
-#include <math.h>
#include <complex.h>
+#include <math.h>
typedef union {
float complex z;
diff --git a/lib/libm/__cos.c b/lib/libm/__cos.c
index 5e4665e2..a55d0eba 100644
--- a/lib/libm/__cos.c
+++ b/lib/libm/__cos.c
@@ -48,7 +48,9 @@
* any extra precision in w.
*/
-#include "libm.h"
+#include "libm.h" // for __cos
+
+#include <math.h> // for double_t
static const double C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C
*/
diff --git a/lib/libm/__cosdf.c b/lib/libm/__cosdf.c
index cda7195c..d5469271 100644
--- a/lib/libm/__cosdf.c
+++ b/lib/libm/__cosdf.c
@@ -14,7 +14,9 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __cosdf
+
+#include <math.h> // for double_t
/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */
static const double C0 = -0x1ffffffd0c5e81.0p-54, /* -0.499999997251031003120 */
diff --git a/lib/libm/__cosl.c b/lib/libm/__cosl.c
index c7f72114..18858e6b 100644
--- a/lib/libm/__cosl.c
+++ b/lib/libm/__cosl.c
@@ -12,7 +12,9 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __cosl
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
#if LDBL_MANT_DIG == 64
@@ -51,9 +53,12 @@ static const double C2 = -0.0013888888888888874, /* -0x16c16c16c16c10.0p-62 */
C5 = 0.0000000020876754400407278, /* 0x11eed8caaeccf1.0p-81 */
C6 = -1.1470297442401303e-11, /* -0x19393412bd1529.0p-89 */
C7 = 4.7383039476436467e-14; /* 0x1aac9d9af5c43e.0p-97 */
-#define POLY(z) \
- (z * \
- (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * (C6 + z * C7)))))))
+#define POLY(z) \
+ ((z) * \
+ (C1 + \
+ (z) * (C2 + \
+ (z) * (C3 + \
+ (z) * (C4 + (z) * (C5 + (z) * (C6 + (z) * C7)))))))
#elif LDBL_MANT_DIG == 113
/*
* ld128 version of __cos.c. See __cos.c for most comments.
diff --git a/lib/libm/__expo2.c b/lib/libm/__expo2.c
index 0d025457..aa26d4ad 100644
--- a/lib/libm/__expo2.c
+++ b/lib/libm/__expo2.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for INSERT_WORDS, __expo2
+
+#include <math.h> // for exp
+#include <stdint.h> // for uint32_t
/* k is such that k*ln2 has minimal relative error and x - kln2 > log(DBL_MIN)
*/
diff --git a/lib/libm/__expo2f.c b/lib/libm/__expo2f.c
index 524be700..2bb6699c 100644
--- a/lib/libm/__expo2f.c
+++ b/lib/libm/__expo2f.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for SET_FLOAT_WORD, __expo2f
+
+#include <math.h> // for expf
+#include <stdint.h> // for uint32_t
/* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN)
*/
diff --git a/lib/libm/__fpclassify.c b/lib/libm/__fpclassify.c
index 41332adf..2a961b1c 100644
--- a/lib/libm/__fpclassify.c
+++ b/lib/libm/__fpclassify.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL
+#include <stdint.h> // for uint64_t
int __fpclassify(double x)
{
diff --git a/lib/libm/__fpclassifyf.c b/lib/libm/__fpclassifyf.c
index c8fc7585..d1b6d8bb 100644
--- a/lib/libm/__fpclassifyf.c
+++ b/lib/libm/__fpclassifyf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL
+#include <stdint.h> // for uint32_t
int __fpclassifyf(float x)
{
diff --git a/lib/libm/__fpclassifyl.c b/lib/libm/__fpclassifyl.c
index 2c293803..e9f08a42 100644
--- a/lib/libm/__fpclassifyl.c
+++ b/lib/libm/__fpclassifyl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), __BYTE_ORDER, __LI...
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_...
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
int __fpclassifyl(long double x)
diff --git a/lib/libm/__invtrigl.c b/lib/libm/__invtrigl.c
index 66e4c7eb..8e8273ae 100644
--- a/lib/libm/__invtrigl.c
+++ b/lib/libm/__invtrigl.c
@@ -1,6 +1,7 @@
-#include <float.h>
#include "__invtrigl.h"
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+
#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
static const long double pS0 = 1.66666666666666666631e-01L,
pS1 = -4.16313987993683104320e-01L,
diff --git a/lib/libm/__math_divzero.c b/lib/libm/__math_divzero.c
index 59d21350..0aefe12a 100644
--- a/lib/libm/__math_divzero.c
+++ b/lib/libm/__math_divzero.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_divzero, fp_barrier
+
+#include <stdint.h> // for uint32_t
double __math_divzero(uint32_t sign)
{
diff --git a/lib/libm/__math_divzerof.c b/lib/libm/__math_divzerof.c
index ce046f3e..33caf400 100644
--- a/lib/libm/__math_divzerof.c
+++ b/lib/libm/__math_divzerof.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_divzerof, fp_barrierf
+
+#include <stdint.h> // for uint32_t
float __math_divzerof(uint32_t sign)
{
diff --git a/lib/libm/__math_invalid.c b/lib/libm/__math_invalid.c
index 17740490..dbbbbfb8 100644
--- a/lib/libm/__math_invalid.c
+++ b/lib/libm/__math_invalid.c
@@ -1,4 +1,4 @@
-#include "libm.h"
+#include "libm.h" // for __math_invalid
double __math_invalid(double x)
{
diff --git a/lib/libm/__math_invalidf.c b/lib/libm/__math_invalidf.c
index 357d4b12..f44a7f09 100644
--- a/lib/libm/__math_invalidf.c
+++ b/lib/libm/__math_invalidf.c
@@ -1,4 +1,4 @@
-#include "libm.h"
+#include "libm.h" // for __math_invalidf
float __math_invalidf(float x)
{
diff --git a/lib/libm/__math_invalidl.c b/lib/libm/__math_invalidl.c
index 1fca99de..8ab1f535 100644
--- a/lib/libm/__math_invalidl.c
+++ b/lib/libm/__math_invalidl.c
@@ -1,5 +1,6 @@
-#include <float.h>
-#include "libm.h"
+#include "libm.h" // for __math_invalidl
+
+#include <float.h> // for DBL_MANT_DIG, LDBL_MANT_DIG
#if LDBL_MANT_DIG != DBL_MANT_DIG
long double __math_invalidl(long double x)
diff --git a/lib/libm/__math_oflow.c b/lib/libm/__math_oflow.c
index c85dbf98..b87d6f0e 100644
--- a/lib/libm/__math_oflow.c
+++ b/lib/libm/__math_oflow.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_xflow, __math_oflow
+
+#include <stdint.h> // for uint32_t
double __math_oflow(uint32_t sign)
{
diff --git a/lib/libm/__math_oflowf.c b/lib/libm/__math_oflowf.c
index fa7d0620..71171b88 100644
--- a/lib/libm/__math_oflowf.c
+++ b/lib/libm/__math_oflowf.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_xflowf, __math_oflowf
+
+#include <stdint.h> // for uint32_t
float __math_oflowf(uint32_t sign)
{
diff --git a/lib/libm/__math_uflow.c b/lib/libm/__math_uflow.c
index b90594ae..6bf63f36 100644
--- a/lib/libm/__math_uflow.c
+++ b/lib/libm/__math_uflow.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_xflow, __math_uflow
+
+#include <stdint.h> // for uint32_t
double __math_uflow(uint32_t sign)
{
diff --git a/lib/libm/__math_uflowf.c b/lib/libm/__math_uflowf.c
index 94d50f2b..714fdb71 100644
--- a/lib/libm/__math_uflowf.c
+++ b/lib/libm/__math_uflowf.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for __math_xflowf, __math_uflowf
+
+#include <stdint.h> // for uint32_t
float __math_uflowf(uint32_t sign)
{
diff --git a/lib/libm/__math_xflow.c b/lib/libm/__math_xflow.c
index 744203c4..c3626a2f 100644
--- a/lib/libm/__math_xflow.c
+++ b/lib/libm/__math_xflow.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for eval_as_double, __math_xflow, fp_barrier
+
+#include <stdint.h> // for uint32_t
double __math_xflow(uint32_t sign, double y)
{
diff --git a/lib/libm/__math_xflowf.c b/lib/libm/__math_xflowf.c
index f2c84784..b660d92a 100644
--- a/lib/libm/__math_xflowf.c
+++ b/lib/libm/__math_xflowf.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for eval_as_float, __math_xflowf, fp_barrierf
+
+#include <stdint.h> // for uint32_t
float __math_xflowf(uint32_t sign, float y)
{
diff --git a/lib/libm/__polevll.c b/lib/libm/__polevll.c
index ce1a8404..9028d48b 100644
--- a/lib/libm/__polevll.c
+++ b/lib/libm/__polevll.c
@@ -54,7 +54,9 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for __p1evll, __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
#else
diff --git a/lib/libm/__rem_pio2.c b/lib/libm/__rem_pio2.c
index d01bc23b..1d81061f 100644
--- a/lib/libm/__rem_pio2.c
+++ b/lib/libm/__rem_pio2.c
@@ -17,7 +17,11 @@
* use __rem_pio2_large() for large x
*/
-#include "libm.h"
+#include "libm.h" // for __rem_pio2_large, predict_false, __rem_pio2
+
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for double_t
+#include <stdint.h> // for uint64_t, int32_t, uint32_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
@@ -67,25 +71,22 @@ int __rem_pio2(double x, double *y)
y[0] = z - pio2_1t;
y[1] = (z - y[0]) - pio2_1t;
return 1;
- } else {
- z = x + pio2_1;
- y[0] = z + pio2_1t;
- y[1] = (z - y[0]) + pio2_1t;
- return -1;
- }
- } else {
- if (!sign) {
- z = x - 2 * pio2_1;
- y[0] = z - 2 * pio2_1t;
- y[1] = (z - y[0]) - 2 * pio2_1t;
- return 2;
- } else {
- z = x + 2 * pio2_1;
- y[0] = z + 2 * pio2_1t;
- y[1] = (z - y[0]) + 2 * pio2_1t;
- return -2;
}
+ z = x + pio2_1;
+ y[0] = z + pio2_1t;
+ y[1] = (z - y[0]) + pio2_1t;
+ return -1;
+ }
+ if (!sign) {
+ z = x - 2 * pio2_1;
+ y[0] = z - 2 * pio2_1t;
+ y[1] = (z - y[0]) - 2 * pio2_1t;
+ return 2;
}
+ z = x + 2 * pio2_1;
+ y[0] = z + 2 * pio2_1t;
+ y[1] = (z - y[0]) + 2 * pio2_1t;
+ return -2;
}
if (ix <= 0x401c463b) { /* |x| ~<= 9pi/4 */
if (ix <= 0x4015fdbc) { /* |x| ~<= 7pi/4 */
@@ -96,27 +97,24 @@ int __rem_pio2(double x, double *y)
y[0] = z - 3 * pio2_1t;
y[1] = (z - y[0]) - 3 * pio2_1t;
return 3;
- } else {
- z = x + 3 * pio2_1;
- y[0] = z + 3 * pio2_1t;
- y[1] = (z - y[0]) + 3 * pio2_1t;
- return -3;
- }
- } else {
- if (ix == 0x401921fb) /* |x| ~= 4pi/2 */
- goto medium;
- if (!sign) {
- z = x - 4 * pio2_1;
- y[0] = z - 4 * pio2_1t;
- y[1] = (z - y[0]) - 4 * pio2_1t;
- return 4;
- } else {
- z = x + 4 * pio2_1;
- y[0] = z + 4 * pio2_1t;
- y[1] = (z - y[0]) + 4 * pio2_1t;
- return -4;
}
+ z = x + 3 * pio2_1;
+ y[0] = z + 3 * pio2_1t;
+ y[1] = (z - y[0]) + 3 * pio2_1t;
+ return -3;
+ }
+ if (ix == 0x401921fb) /* |x| ~= 4pi/2 */
+ goto medium;
+ if (!sign) {
+ z = x - 4 * pio2_1;
+ y[0] = z - 4 * pio2_1t;
+ y[1] = (z - y[0]) - 4 * pio2_1t;
+ return 4;
}
+ z = x + 4 * pio2_1;
+ y[0] = z + 4 * pio2_1t;
+ y[1] = (z - y[0]) + 4 * pio2_1t;
+ return -4;
}
if (ix < 0x413921fb) { /* |x| ~< 2^20*(pi/2), medium size */
medium:
diff --git a/lib/libm/__rem_pio2_large.c b/lib/libm/__rem_pio2_large.c
index 58defa09..8b97a6f6 100644
--- a/lib/libm/__rem_pio2_large.c
+++ b/lib/libm/__rem_pio2_large.c
@@ -122,7 +122,11 @@
* to produce the hexadecimal values shown.
*/
-#include "libm.h"
+#include "libm.h" // for __rem_pio2_large
+
+#include <float.h> // for LDBL_MAX_EXP
+#include <math.h> // for scalbn, floor
+#include <stdint.h> // for int32_t
static const int init_jk[] = { 3, 4, 4, 6 }; /* initial value for jk */
diff --git a/lib/libm/__rem_pio2f.c b/lib/libm/__rem_pio2f.c
index 8d58b491..6316b60a 100644
--- a/lib/libm/__rem_pio2f.c
+++ b/lib/libm/__rem_pio2f.c
@@ -20,7 +20,11 @@
* use __rem_pio2_large() for large x
*/
-#include "libm.h"
+#include "libm.h" // for __rem_pio2_large, predict_false, __rem_pio2f
+
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for double_t
+#include <stdint.h> // for uint32_t, int32_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
diff --git a/lib/libm/__rem_pio2l.c b/lib/libm/__rem_pio2l.c
index f6310774..f5d28dde 100644
--- a/lib/libm/__rem_pio2l.c
+++ b/lib/libm/__rem_pio2l.c
@@ -12,7 +12,10 @@
*
* Optimized by Bruce D. Evans.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), __rem_pio2_large
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_EPSILON, LDBL_MAX_EXP
+#include <stdint.h> // for int32_t, uint32_t
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
/* ld80 and ld128 version of __rem_pio2(x,y)
*
@@ -24,10 +27,10 @@ static const long double toint = 1.5 / LDBL_EPSILON;
#if LDBL_MANT_DIG == 64
/* u ~< 0x1p25*pi/2 */
-#define SMALL(u) \
- (((u.i.se & 0x7fffU) << 16 | u.i.m >> 48) < \
+#define SMALL(u) \
+ ((((u).i.se & 0x7fffU) << 16 | (u).i.m >> 48) < \
((0x3fff + 25) << 16 | 0x921f >> 1 | 0x8000))
-#define QUOBITS(x) ((uint32_t)(int32_t)x & 0x7fffffff)
+#define QUOBITS(x) ((uint32_t)(int32_t)(x) & 0x7fffffff)
#define ROUND1 22
#define ROUND2 61
#define NX 3
diff --git a/lib/libm/__signbit.c b/lib/libm/__signbit.c
index 5d145b63..54fecb88 100644
--- a/lib/libm/__signbit.c
+++ b/lib/libm/__signbit.c
@@ -1,4 +1,4 @@
-#include "libm.h"
+#include <stdint.h> // for uint64_t
// FIXME: macro in math.h
int __signbit(double x)
diff --git a/lib/libm/__signbitf.c b/lib/libm/__signbitf.c
index 3e6c4466..da4ba6a7 100644
--- a/lib/libm/__signbitf.c
+++ b/lib/libm/__signbitf.c
@@ -1,4 +1,4 @@
-#include "libm.h"
+#include <stdint.h> // for uint32_t
// FIXME: macro in math.h
int __signbitf(float x)
diff --git a/lib/libm/__signbitl.c b/lib/libm/__signbitl.c
index b66d419f..7b02186a 100644
--- a/lib/libm/__signbitl.c
+++ b/lib/libm/__signbitl.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
int __signbitl(long double x)
diff --git a/lib/libm/__sin.c b/lib/libm/__sin.c
index c8b8cad8..e44c66e7 100644
--- a/lib/libm/__sin.c
+++ b/lib/libm/__sin.c
@@ -39,7 +39,9 @@
* sin(x) = x + (S1*x + (x *(r-y/2)+y))
*/
-#include "libm.h"
+#include "libm.h" // for __sin
+
+#include <math.h> // for double_t
static const double S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549
*/
@@ -59,6 +61,5 @@ double __sin(double x, double y, int iy)
v = z * x;
if (iy == 0)
return x + v * (S1 + z * r);
- else
- return x - ((z * (0.5 * y - v * r) - y) - v * S1);
+ return x - ((z * (0.5 * y - v * r) - y) - v * S1);
}
diff --git a/lib/libm/__sindf.c b/lib/libm/__sindf.c
index cf16370d..b6b9cf42 100644
--- a/lib/libm/__sindf.c
+++ b/lib/libm/__sindf.c
@@ -14,7 +14,9 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __sindf
+
+#include <math.h> // for double_t
/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
static const double S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */
diff --git a/lib/libm/__sinl.c b/lib/libm/__sinl.c
index 6b57783e..ecc23a1a 100644
--- a/lib/libm/__sinl.c
+++ b/lib/libm/__sinl.c
@@ -12,7 +12,9 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __sinl
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
#if LDBL_MANT_DIG == 64
@@ -35,8 +37,10 @@ static const double S2 = 0.0083333333333333332, /* 0x11111111111111.0p-59 */
S6 = 1.6059006598854211e-10, /* 0x161242b90243b5.0p-85 */
S7 = -7.6429779983024564e-13, /* -0x1ae42ebd1b2e00.0p-93 */
S8 = 2.6174587166648325e-15; /* 0x179372ea0b3f64.0p-101 */
-#define POLY(z) \
- (S2 + z * (S3 + z * (S4 + z * (S5 + z * (S6 + z * (S7 + z * S8))))))
+#define POLY(z) \
+ (S2 + \
+ (z) * (S3 + \
+ (z) * (S4 + (z) * (S5 + (z) * (S6 + (z) * (S7 + (z) * S8))))))
#elif LDBL_MANT_DIG == 113
/*
* ld128 version of __sin.c. See __sin.c for most comments.
diff --git a/lib/libm/__tan.c b/lib/libm/__tan.c
index 9fd6c41a..9abfff35 100644
--- a/lib/libm/__tan.c
+++ b/lib/libm/__tan.c
@@ -44,7 +44,10 @@
* = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
*/
-#include "libm.h"
+#include "libm.h" // for SET_LOW_WORD, GET_HIGH_WORD, __tan
+
+#include <math.h> // for double_t
+#include <stdint.h> // for uint32_t
static const double T[] = {
3.33333333333334091986e-01, /* 3FD55555, 55555563 */
diff --git a/lib/libm/__tandf.c b/lib/libm/__tandf.c
index 7219ed33..5bae8073 100644
--- a/lib/libm/__tandf.c
+++ b/lib/libm/__tandf.c
@@ -13,7 +13,9 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __tandf
+
+#include <math.h> // for double_t
/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */
static const double T[] = {
diff --git a/lib/libm/__tanl.c b/lib/libm/__tanl.c
index 7526735c..28167d02 100644
--- a/lib/libm/__tanl.c
+++ b/lib/libm/__tanl.c
@@ -11,7 +11,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __tanl
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for fabsl
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
#if LDBL_MANT_DIG == 64
@@ -44,14 +47,18 @@ static const double T9 = 0.021869488536312216, /* 0x1664f4882cc1c2.0p-58 */
T29 = 0.0000078293456938132840, /* 0x106b59141a6cb3.0p-69 */
T31 = -0.0000032609076735050182, /* -0x1b5abef3ba4b59.0p-71 */
T33 = 0.0000023261313142559411; /* 0x13835436c0c87f.0p-71 */
-#define RPOLY(w) \
- (T5 + \
- w * (T9 + \
- w * (T13 + \
- w * (T17 + w * (T21 + w * (T25 + w * (T29 + w * T33)))))))
-#define VPOLY(w) \
- (T7 + \
- w * (T11 + w * (T15 + w * (T19 + w * (T23 + w * (T27 + w * T31))))))
+#define RPOLY(w) \
+ (T5 + \
+ (w) * (T9 + (w) * (T13 + \
+ (w) * (T17 + \
+ (w) * (T21 + \
+ (w) * (T25 + \
+ (w) * (T29 + (w) * T33)))))))
+#define VPOLY(w) \
+ (T7 + \
+ (w) * (T11 + \
+ (w) * (T15 + \
+ (w) * (T19 + (w) * (T23 + (w) * (T27 + (w) * T31))))))
#elif LDBL_MANT_DIG == 113
/*
* ld128 version of __tan.c. See __tan.c for most comments.
diff --git a/lib/libm/acos.c b/lib/libm/acos.c
index cc798159..67c059af 100644
--- a/lib/libm/acos.c
+++ b/lib/libm/acos.c
@@ -33,7 +33,10 @@
* Function needed: sqrt
*/
-#include "libm.h"
+#include "libm.h" // for GET_HIGH_WORD, GET_LOW_WORD, SET_LOW_WORD
+
+#include <math.h> // for sqrt, acos, double_t
+#include <stdint.h> // for uint32_t
static const double pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB,
0x54442D18 */
diff --git a/lib/libm/acosf.c b/lib/libm/acosf.c
index a428e8d6..51e5c5ea 100644
--- a/lib/libm/acosf.c
+++ b/lib/libm/acosf.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD, SET_FLOAT_WORD
+
+#include <math.h> // for sqrtf, acosf, float_t
+#include <stdint.h> // for uint32_t
static const float pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */
pio2_lo = 7.5497894159e-08, /* 0x33a22168 */
diff --git a/lib/libm/acosh.c b/lib/libm/acosh.c
index a53e01ed..cb4036e5 100644
--- a/lib/libm/acosh.c
+++ b/lib/libm/acosh.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include <float.h> // for FLT_EVAL_METHOD
+#include <math.h> // for log, sqrt, acosh, log1p
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD == 2
#undef sqrt
diff --git a/lib/libm/acoshf.c b/lib/libm/acoshf.c
index 515ca313..ddf87b7e 100644
--- a/lib/libm/acoshf.c
+++ b/lib/libm/acoshf.c
@@ -1,4 +1,6 @@
-#include "libm.h"
+#include <float.h> // for FLT_EVAL_METHOD
+#include <math.h> // for logf, sqrtf, acoshf, log1pf
+#include <stdint.h> // for uint32_t
#if FLT_EVAL_METHOD == 2
#undef sqrtf
diff --git a/lib/libm/acoshl.c b/lib/libm/acoshl.c
index f76c5b44..015dfc6a 100644
--- a/lib/libm/acoshl.c
+++ b/lib/libm/acoshl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for logl, sqrtl, acoshl, log1pl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double acoshl(long double x)
diff --git a/lib/libm/acosl.c b/lib/libm/acosl.c
index f508a552..009df082 100644
--- a/lib/libm/acosl.c
+++ b/lib/libm/acosl.c
@@ -14,7 +14,11 @@
* Converted to long double by David Schultz <das@FreeBSD.ORG>.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for sqrtl, acosl
+#include <stdint.h> // for uint16_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double acosl(long double x)
@@ -22,9 +26,9 @@ long double acosl(long double x)
return acos(x);
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#include "__invtrigl.h"
+#include "__invtrigl.h" // for __invtrigl_R, pio2_hi, pio2_lo
#if LDBL_MANT_DIG == 64
-#define CLEARBOTTOM(u) (u.i.m &= -1ULL << 32)
+#define CLEARBOTTOM(u) ((u).i.m &= -1ULL << 32)
#elif LDBL_MANT_DIG == 113
#define CLEARBOTTOM(u) (u.i.lo = 0)
#endif
diff --git a/lib/libm/asin.c b/lib/libm/asin.c
index a7632829..eb669b87 100644
--- a/lib/libm/asin.c
+++ b/lib/libm/asin.c
@@ -39,7 +39,10 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for GET_HIGH_WORD, GET_LOW_WORD, SET_LOW_WORD
+
+#include <math.h> // for asin, double_t, fabs, sqrt
+#include <stdint.h> // for uint32_t
static const double pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB,
0x54442D18 */
diff --git a/lib/libm/asinf.c b/lib/libm/asinf.c
index 65ee2ae7..0175f4d5 100644
--- a/lib/libm/asinf.c
+++ b/lib/libm/asinf.c
@@ -12,7 +12,10 @@
* is preserved.
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD
+
+#include <math.h> // for asinf, fabsf, float_t, sqrtf
+#include <stdint.h> // for uint32_t
static const double pio2 = 1.570796326794896558e+00;
@@ -52,7 +55,7 @@ float asinf(float x)
}
/* 1 > |x| >= 0.5 */
z = (1 - fabsf(x)) * 0.5f;
- s = sqrt(z);
+ s = sqrtf(z);
x = pio2 - 2 * (s + s * R(z));
if (hx >> 31)
return -x;
diff --git a/lib/libm/asinh.c b/lib/libm/asinh.c
index 196a81ef..f6018734 100644
--- a/lib/libm/asinh.c
+++ b/lib/libm/asinh.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for log, sqrt, asinh, log1p
+#include <stdint.h> // for uint64_t
/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */
double asinh(double x)
diff --git a/lib/libm/asinhf.c b/lib/libm/asinhf.c
index 2f6c585b..72d3d232 100644
--- a/lib/libm/asinhf.c
+++ b/lib/libm/asinhf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for logf, sqrtf, asinhf, log1pf
+#include <stdint.h> // for uint32_t
/* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */
float asinhf(float x)
diff --git a/lib/libm/asinhl.c b/lib/libm/asinhl.c
index 321f2a0f..8f8c2ab2 100644
--- a/lib/libm/asinhl.c
+++ b/lib/libm/asinhl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for logl, sqrtl, asinhl, log1pl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double asinhl(long double x)
diff --git a/lib/libm/asinl.c b/lib/libm/asinl.c
index 8dd0268c..7a5f6710 100644
--- a/lib/libm/asinl.c
+++ b/lib/libm/asinl.c
@@ -14,7 +14,11 @@
* Converted to long double by David Schultz <das@FreeBSD.ORG>.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for asinl, fabsl, sqrtl
+#include <stdint.h> // for uint16_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double asinl(long double x)
@@ -22,10 +26,10 @@ long double asinl(long double x)
return asin(x);
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#include "__invtrigl.h"
+#include "__invtrigl.h" // for __invtrigl_R, pio2_hi, pio2_lo
#if LDBL_MANT_DIG == 64
-#define CLOSETO1(u) (u.i.m >> 56 >= 0xf7)
-#define CLEARBOTTOM(u) (u.i.m &= -1ULL << 32)
+#define CLOSETO1(u) ((u).i.m >> 56 >= 0xf7)
+#define CLEARBOTTOM(u) ((u).i.m &= -1ULL << 32)
#elif LDBL_MANT_DIG == 113
#define CLOSETO1(u) (u.i.top >= 0xee00)
#define CLEARBOTTOM(u) (u.i.lo = 0)
diff --git a/lib/libm/atan.c b/lib/libm/atan.c
index 6793af93..36d10d73 100644
--- a/lib/libm/atan.c
+++ b/lib/libm/atan.c
@@ -29,7 +29,10 @@
* to produce the hexadecimal values shown.
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL, GET_HIGH_WORD
+
+#include <math.h> // for double_t, atan, fabs, isnan
+#include <stdint.h> // for uint32_t
static const double atanhi[] = {
4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
diff --git a/lib/libm/atan2.c b/lib/libm/atan2.c
index 3298b6c4..912d9fb5 100644
--- a/lib/libm/atan2.c
+++ b/lib/libm/atan2.c
@@ -37,7 +37,10 @@
* to produce the hexadecimal values shown.
*/
-#include "libm.h"
+#include "libm.h" // for EXTRACT_WORDS
+
+#include <math.h> // for atan, atan2, fabs, isnan
+#include <stdint.h> // for uint32_t
static const double pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
diff --git a/lib/libm/atan2f.c b/lib/libm/atan2f.c
index 01f32d20..34e58db8 100644
--- a/lib/libm/atan2f.c
+++ b/lib/libm/atan2f.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD
+
+#include <math.h> // for atanf, atan2f, fabsf, isnan
+#include <stdint.h> // for uint32_t
static const float pi = 3.1415927410e+00, /* 0x40490fdb */
pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
diff --git a/lib/libm/atan2l.c b/lib/libm/atan2l.c
index f2f60986..ca47169a 100644
--- a/lib/libm/atan2l.c
+++ b/lib/libm/atan2l.c
@@ -15,7 +15,10 @@
* Converted to long double by David Schultz <das@FreeBSD.ORG>.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for atanl, atan2l, fabsl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double atan2l(long double y, long double x)
@@ -23,7 +26,7 @@ long double atan2l(long double y, long double x)
return atan2(y, x);
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#include "__invtrigl.h"
+#include "__invtrigl.h" // for pio2_hi, pio2_lo
long double atan2l(long double y, long double x)
{
diff --git a/lib/libm/atanf.c b/lib/libm/atanf.c
index 48f18e30..74881a92 100644
--- a/lib/libm/atanf.c
+++ b/lib/libm/atanf.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL, GET_FLOAT_WORD
+
+#include <math.h> // for float_t, atanf, fabsf, isnan
+#include <stdint.h> // for uint32_t
static const float atanhi[] = {
4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */
diff --git a/lib/libm/atanh.c b/lib/libm/atanh.c
index 08a34d7e..ec0c7a61 100644
--- a/lib/libm/atanh.c
+++ b/lib/libm/atanh.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for log1p, atanh, double_t
+#include <stdint.h> // for uint64_t
/* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */
double atanh(double x)
diff --git a/lib/libm/atanhf.c b/lib/libm/atanhf.c
index d1026974..b4591890 100644
--- a/lib/libm/atanhf.c
+++ b/lib/libm/atanhf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for log1pf, atanhf, float_t
+#include <stdint.h> // for uint32_t
/* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */
float atanhf(float x)
diff --git a/lib/libm/atanhl.c b/lib/libm/atanhl.c
index 8afd5a03..cc5351cb 100644
--- a/lib/libm/atanhl.c
+++ b/lib/libm/atanhl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for log1pl, atanhl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double atanhl(long double x)
diff --git a/lib/libm/atanl.c b/lib/libm/atanl.c
index c1c75c94..1f1bff44 100644
--- a/lib/libm/atanl.c
+++ b/lib/libm/atanl.c
@@ -14,7 +14,10 @@
* Converted to long double by David Schultz <das@FreeBSD.ORG>.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for atanl, fabsl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double atanl(long double x)
@@ -24,7 +27,7 @@ long double atanl(long double x)
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
#if LDBL_MANT_DIG == 64
-#define EXPMAN(u) ((u.i.se & 0x7fff) << 8 | (u.i.m >> 55 & 0xff))
+#define EXPMAN(u) (((u).i.se & 0x7fff) << 8 | ((u).i.m >> 55 & 0xff))
static const long double atanhi[] = {
4.63647609000806116202e-01L,
diff --git a/lib/libm/cabs.c b/lib/libm/cabs.c
index 6bbcd878..79452553 100644
--- a/lib/libm/cabs.c
+++ b/lib/libm/cabs.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cabs, cimag, creal, complex
+#include <math.h> // for hypot
double cabs(double complex z)
{
diff --git a/lib/libm/cabsf.c b/lib/libm/cabsf.c
index 667ba935..5eee73bc 100644
--- a/lib/libm/cabsf.c
+++ b/lib/libm/cabsf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cabsf, cimagf, crealf, complex
+#include <math.h> // for hypotf
float cabsf(float complex z)
{
diff --git a/lib/libm/cabsl.c b/lib/libm/cabsl.c
index 42d11909..e3878ec4 100644
--- a/lib/libm/cabsl.c
+++ b/lib/libm/cabsl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cabsl, cimagl, creall, complex
+#include <math.h> // for hypotl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double cabsl(long double complex z)
diff --git a/lib/libm/cacos.c b/lib/libm/cacos.c
index 1248e72f..b472b778 100644
--- a/lib/libm/cacos.c
+++ b/lib/libm/cacos.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for complex, cacos, casin, cimag, creal, I
+#include <math.h> // for M_PI_2
double complex cacos(double complex z)
{
diff --git a/lib/libm/cacosf.c b/lib/libm/cacosf.c
index f44f0067..12f86362 100644
--- a/lib/libm/cacosf.c
+++ b/lib/libm/cacosf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for complex, cacosf, casinf, cimagf, crealf, I
+#include <math.h> // for M_PI_2
float complex cacosf(float complex z)
{
diff --git a/lib/libm/cacosh.c b/lib/libm/cacosh.c
index 00f0e736..bf33b7c7 100644
--- a/lib/libm/cacosh.c
+++ b/lib/libm/cacosh.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for csqrt, cacosh, clog, complex
double complex cacosh(double complex z)
{
diff --git a/lib/libm/cacoshf.c b/lib/libm/cacoshf.c
index 63d23257..0a290396 100644
--- a/lib/libm/cacoshf.c
+++ b/lib/libm/cacoshf.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for csqrtf, cacoshf, clogf, complex
float complex cacoshf(float complex z)
{
diff --git a/lib/libm/cacoshl.c b/lib/libm/cacoshl.c
index abe906ef..058f85da 100644
--- a/lib/libm/cacoshl.c
+++ b/lib/libm/cacoshl.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for csqrtl, cacoshl, clogl, complex
long double complex cacoshl(long double complex z)
{
diff --git a/lib/libm/cacosl.c b/lib/libm/cacosl.c
index c56076b3..484ef699 100644
--- a/lib/libm/cacosl.c
+++ b/lib/libm/cacosl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for complex, cacosl, casinl, cimagl, creall, I
+#include <math.h> // for M_PI_2
long double complex cacosl(long double complex z)
{
diff --git a/lib/libm/carg.c b/lib/libm/carg.c
index 634ace3d..12cbd1a3 100644
--- a/lib/libm/carg.c
+++ b/lib/libm/carg.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for carg, complex
+#include <math.h> // for atan2
double carg(double complex z)
{
diff --git a/lib/libm/cargf.c b/lib/libm/cargf.c
index 138f19c3..f7cee9dc 100644
--- a/lib/libm/cargf.c
+++ b/lib/libm/cargf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cargf, complex
+#include <math.h> // for atan2f
float cargf(float complex z)
{
diff --git a/lib/libm/cargl.c b/lib/libm/cargl.c
index 9469bf3b..255affbf 100644
--- a/lib/libm/cargl.c
+++ b/lib/libm/cargl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cargl, complex
+#include <math.h> // for atan2l
long double cargl(long double complex z)
{
diff --git a/lib/libm/casin.c b/lib/libm/casin.c
index e23cdd15..f163dc02 100644
--- a/lib/libm/casin.c
+++ b/lib/libm/casin.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, cimag, creal, complex, casin, clog, csqrt
double complex casin(double complex z)
{
diff --git a/lib/libm/casinf.c b/lib/libm/casinf.c
index b0887029..797ea94b 100644
--- a/lib/libm/casinf.c
+++ b/lib/libm/casinf.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, cimagf, crealf, complex, casinf, clogf, csqrtf
float complex casinf(float complex z)
{
diff --git a/lib/libm/casinh.c b/lib/libm/casinh.c
index 75b1b5c9..69b73a39 100644
--- a/lib/libm/casinh.c
+++ b/lib/libm/casinh.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, casin, casinh, complex
double complex casinh(double complex z)
{
diff --git a/lib/libm/casinhf.c b/lib/libm/casinhf.c
index b35ea8a2..d5e3391a 100644
--- a/lib/libm/casinhf.c
+++ b/lib/libm/casinhf.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, casinf, casinhf, complex
float complex casinhf(float complex z)
{
diff --git a/lib/libm/casinhl.c b/lib/libm/casinhl.c
index 73c80203..52d84800 100644
--- a/lib/libm/casinhl.c
+++ b/lib/libm/casinhl.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, casinhl, casinl, complex
long double complex casinhl(long double complex z)
{
diff --git a/lib/libm/casinl.c b/lib/libm/casinl.c
index 45c19582..07061cc4 100644
--- a/lib/libm/casinl.c
+++ b/lib/libm/casinl.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, cimagl, creall, complex, casinl, clogl, csqrtl
long double complex casinl(long double complex z)
{
diff --git a/lib/libm/catan.c b/lib/libm/catan.c
index b6880811..f216394a 100644
--- a/lib/libm/catan.c
+++ b/lib/libm/catan.c
@@ -1,5 +1,8 @@
-#include <float.h>
-#include "__complex.h"
+#include "__complex.h" // for redupi
+
+#include <complex.h> // for complex, I, catan, cimag, creal
+#include <float.h> // for DBL_MAX
+#include <math.h> // for atan2, log
double complex catan(double complex z)
{
diff --git a/lib/libm/catanf.c b/lib/libm/catanf.c
index 16d480e0..89f75a9e 100644
--- a/lib/libm/catanf.c
+++ b/lib/libm/catanf.c
@@ -1,5 +1,8 @@
-#include <float.h>
-#include "__complex.h"
+#include "__complex.h" // for redupif
+
+#include <complex.h> // for complex, I, catanf, cimagf, crealf
+#include <float.h> // for FLT_MAX
+#include <math.h> // for atan2f, logf
float complex catanf(float complex z)
{
diff --git a/lib/libm/catanh.c b/lib/libm/catanh.c
index 5cfc4fc0..739cba4c 100644
--- a/lib/libm/catanh.c
+++ b/lib/libm/catanh.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, catan, catanh, complex
double complex catanh(double complex z)
{
diff --git a/lib/libm/catanhf.c b/lib/libm/catanhf.c
index 0f16fc25..b4536225 100644
--- a/lib/libm/catanhf.c
+++ b/lib/libm/catanhf.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, catanf, catanhf, complex
float complex catanhf(float complex z)
{
diff --git a/lib/libm/catanhl.c b/lib/libm/catanhl.c
index 1fd4275b..4c03e10a 100644
--- a/lib/libm/catanhl.c
+++ b/lib/libm/catanhl.c
@@ -1,4 +1,4 @@
-#include <complex.h>
+#include <complex.h> // for I, catanhl, catanl, complex
long double complex catanhl(long double complex z)
{
diff --git a/lib/libm/catanl.c b/lib/libm/catanl.c
index 949dc3d9..58b14a3c 100644
--- a/lib/libm/catanl.c
+++ b/lib/libm/catanl.c
@@ -1,5 +1,8 @@
-#include <float.h>
-#include "__complex.h"
+#include "__complex.h" // for redupil
+
+#include <complex.h> // for complex, I, catanl, cimagl, creall
+#include <float.h> // for LDBL_MAX
+#include <math.h> // for atan2l, logl
long double complex catanl(long double complex z)
{
diff --git a/lib/libm/cbrt.c b/lib/libm/cbrt.c
index 9f54517d..d583b062 100644
--- a/lib/libm/cbrt.c
+++ b/lib/libm/cbrt.c
@@ -15,8 +15,8 @@
* Return cube root of x
*/
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for double_t, cbrt
+#include <stdint.h> // for uint32_t, uint64_t
static const uint32_t B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20
*/
diff --git a/lib/libm/cbrtf.c b/lib/libm/cbrtf.c
index c394310d..f35aae33 100644
--- a/lib/libm/cbrtf.c
+++ b/lib/libm/cbrtf.c
@@ -17,8 +17,8 @@
* Return cube root of x
*/
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for double_t, cbrtf
+#include <stdint.h> // for uint32_t
static const unsigned B1 = 709958130, /* B1 = (127-127.0/3-0.03306235651)*2**23
*/
diff --git a/lib/libm/cbrtl.c b/lib/libm/cbrtl.c
index 12c82f03..cad8f153 100644
--- a/lib/libm/cbrtl.c
+++ b/lib/libm/cbrtl.c
@@ -15,7 +15,11 @@
* and David A. Schultz.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for double_t, cbrtl, float_t
+#include <stdint.h> // for uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double cbrtl(long double x)
diff --git a/lib/libm/ccos.c b/lib/libm/ccos.c
index d5a8600d..331c5c49 100644
--- a/lib/libm/ccos.c
+++ b/lib/libm/ccos.c
@@ -1,6 +1,7 @@
-#include <math.h>
-#include <complex.h>
-#include "__complex.h"
+#include "__complex.h" // for cchsh
+
+#include <complex.h> // for creal, ccos, cimag, complex, I
+#include <math.h> // for cos, sin
double complex ccos(double complex z)
{
diff --git a/lib/libm/ccosf.c b/lib/libm/ccosf.c
index 8d4a8761..331c5c49 100644
--- a/lib/libm/ccosf.c
+++ b/lib/libm/ccosf.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for cchsh
+
+#include <complex.h> // for creal, ccos, cimag, complex, I
+#include <math.h> // for cos, sin
double complex ccos(double complex z)
{
diff --git a/lib/libm/ccosh.c b/lib/libm/ccosh.c
index 9cfff54a..c96e76b7 100644
--- a/lib/libm/ccosh.c
+++ b/lib/libm/ccosh.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for ccosh, cimag, complex, creal, I
+#include <math.h> // for cos, cosh, sin, sinh
double complex ccosh(double complex z)
{
diff --git a/lib/libm/ccoshf.c b/lib/libm/ccoshf.c
index 12fc7e6d..f2a4d7ef 100644
--- a/lib/libm/ccoshf.c
+++ b/lib/libm/ccoshf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for ccoshf, cimagf, complex, crealf, I
+#include <math.h> // for cosf, coshf, sinf, sinhf
float complex ccoshf(float complex z)
{
diff --git a/lib/libm/ccoshl.c b/lib/libm/ccoshl.c
index ba680068..8e81506d 100644
--- a/lib/libm/ccoshl.c
+++ b/lib/libm/ccoshl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for ccoshl, cimagl, complex, creall, I
+#include <math.h> // for coshl, cosl, sinhl, sinl
long double complex ccoshl(long double complex z)
{
diff --git a/lib/libm/ccosl.c b/lib/libm/ccosl.c
index ee2a3fc0..b6aa2021 100644
--- a/lib/libm/ccosl.c
+++ b/lib/libm/ccosl.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for cchshl
+
+#include <complex.h> // for creall, ccosl, cimagl, complex, I
+#include <math.h> // for cosl, sinl
long double complex ccosl(long double complex z)
{
diff --git a/lib/libm/ceil.c b/lib/libm/ceil.c
index fdf502ed..29f67598 100644
--- a/lib/libm/ceil.c
+++ b/lib/libm/ceil.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for ceil, double_t
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
diff --git a/lib/libm/ceilf.c b/lib/libm/ceilf.c
index 1d9ffd14..49e4e140 100644
--- a/lib/libm/ceilf.c
+++ b/lib/libm/ceilf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for ceilf
+#include <stdint.h> // for uint32_t
float ceilf(float x)
{
diff --git a/lib/libm/ceill.c b/lib/libm/ceill.c
index a9e8f28f..1623faac 100644
--- a/lib/libm/ceill.c
+++ b/lib/libm/ceill.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for ceill
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double ceill(long double x)
diff --git a/lib/libm/cexp.c b/lib/libm/cexp.c
index b8a4b903..1b653aa9 100644
--- a/lib/libm/cexp.c
+++ b/lib/libm/cexp.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cexp, cimag, complex, creal, I
+#include <math.h> // for cos, exp, sin
double complex cexp(double complex z)
{
diff --git a/lib/libm/cexpl.c b/lib/libm/cexpl.c
index 0d3bdfb6..6a83dd84 100644
--- a/lib/libm/cexpl.c
+++ b/lib/libm/cexpl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cexpl, cimagl, complex, creall, I
+#include <math.h> // for cosl, expl, sinl
long double complex cexpl(long double complex z)
{
diff --git a/lib/libm/cexprf.c b/lib/libm/cexprf.c
index 27c5048d..41d98b1f 100644
--- a/lib/libm/cexprf.c
+++ b/lib/libm/cexprf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cexpf, cimagf, complex, crealf, I
+#include <math.h> // for cosf, expf, sinf
float complex cexpf(float complex z)
{
diff --git a/lib/libm/cimag.c b/lib/libm/cimag.c
index 88b5fd58..a52f3962 100644
--- a/lib/libm/cimag.c
+++ b/lib/libm/cimag.c
@@ -1,5 +1,6 @@
-#include <complex.h>
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, double_complex
+
+#include <complex.h> // for cimag, complex
double cimag(double complex z)
{
diff --git a/lib/libm/cimagf.c b/lib/libm/cimagf.c
index 465dce6f..5fe56e60 100644
--- a/lib/libm/cimagf.c
+++ b/lib/libm/cimagf.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, float_complex
+
+#include <complex.h> // for cimagf, complex
float cimagf(float complex z)
{
diff --git a/lib/libm/cimagl.c b/lib/libm/cimagl.c
index 5e63ab5d..553f7da1 100644
--- a/lib/libm/cimagl.c
+++ b/lib/libm/cimagl.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, long_double_complex
+
+#include <complex.h> // for cimagl, complex
long double cimagl(long double complex z)
{
diff --git a/lib/libm/clog.c b/lib/libm/clog.c
index a119934b..0b83a4ea 100644
--- a/lib/libm/clog.c
+++ b/lib/libm/clog.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, cabs, cimag, clog, creal, I
+#include <math.h> // for atan2, log
double complex clog(double complex z)
{
diff --git a/lib/libm/clog10.c b/lib/libm/clog10.c
index a1db1663..6e36572f 100644
--- a/lib/libm/clog10.c
+++ b/lib/libm/clog10.c
@@ -1,5 +1,7 @@
-#include <math.h>
-#include "__complex.h"
+#include "__complex.h" // for M_IVLN10
+
+#include <complex.h> // for complex, cabs, cimag, creal, I
+#include <math.h> // for atan2, log10
double complex clog10(double complex z)
{
diff --git a/lib/libm/clog10f.c b/lib/libm/clog10f.c
index d2994b0d..855069a3 100644
--- a/lib/libm/clog10f.c
+++ b/lib/libm/clog10f.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for M_IVLN10
+
+#include <complex.h> // for cabsf, cimagf, complex, crealf, I
+#include <math.h> // for atan2f, log10f
float complex clog10f(float complex z)
{
diff --git a/lib/libm/clog10l.c b/lib/libm/clog10l.c
index dde228e2..cd4ddcb8 100644
--- a/lib/libm/clog10l.c
+++ b/lib/libm/clog10l.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, cabsl, cimagl, creall, I
+#include <math.h> // for atan2l, log10l
long double complex clog10l(long double complex z)
{
diff --git a/lib/libm/clogf.c b/lib/libm/clogf.c
index f669c7a4..d2f8df33 100644
--- a/lib/libm/clogf.c
+++ b/lib/libm/clogf.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for cabsf, cimagf, clogf, complex, crealf, I
+#include <math.h> // for atan2f, logf
float complex clogf(float complex z)
{
diff --git a/lib/libm/clogl.c b/lib/libm/clogl.c
index f7e0bf0b..67bf4bb7 100644
--- a/lib/libm/clogl.c
+++ b/lib/libm/clogl.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, cabsl, cimagl, clogl, creall, I
+#include <math.h> // for atan2l, logl
long double complex clogl(long double complex z)
{
diff --git a/lib/libm/conj.c b/lib/libm/conj.c
index 5982db3f..614e7bd2 100644
--- a/lib/libm/conj.c
+++ b/lib/libm/conj.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, double_complex
+
+#include <complex.h> // for complex, conj
double complex conj(double complex z)
{
diff --git a/lib/libm/conjf.c b/lib/libm/conjf.c
index d7c6f4cd..31399fb7 100644
--- a/lib/libm/conjf.c
+++ b/lib/libm/conjf.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, float_complex
+
+#include <complex.h> // for complex, conjf
float complex conjf(float complex z)
{
diff --git a/lib/libm/conjl.c b/lib/libm/conjl.c
index 4e633057..7371c11d 100644
--- a/lib/libm/conjl.c
+++ b/lib/libm/conjl.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, long_double_complex
+
+#include <complex.h> // for complex, conjl
long double complex conjl(long double complex z)
{
diff --git a/lib/libm/copysign.c b/lib/libm/copysign.c
index 26982cea..58be427e 100644
--- a/lib/libm/copysign.c
+++ b/lib/libm/copysign.c
@@ -1,4 +1,5 @@
-#include "libm.h"
+#include <math.h> // for copysign
+#include <stdint.h> // for uint64_t
double copysign(double x, double y)
{
diff --git a/lib/libm/copysignf.c b/lib/libm/copysignf.c
index d71c9a5f..ee11604b 100644
--- a/lib/libm/copysignf.c
+++ b/lib/libm/copysignf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for copysignf
+#include <stdint.h> // for uint32_t
float copysignf(float x, float y)
{
diff --git a/lib/libm/copysignl.c b/lib/libm/copysignl.c
index e5e40285..b0fd6b36 100644
--- a/lib/libm/copysignl.c
+++ b/lib/libm/copysignl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for copysignl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double copysignl(long double x, long double y)
diff --git a/lib/libm/cos.c b/lib/libm/cos.c
index e3b3a6fe..251ed66a 100644
--- a/lib/libm/cos.c
+++ b/lib/libm/cos.c
@@ -40,7 +40,10 @@
* TRIG(x) returns trig(x) nearly rounded
*/
-#include "libm.h"
+#include "libm.h" // for __cos, __sin, __rem_pio2, FORCE_EVAL, GET_HIGH_WORD
+
+#include <math.h> // for cos
+#include <stdint.h> // for uint32_t
double cos(double x)
{
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 <math.h> // for M_PI_2, cosf
+#include <stdint.h> // 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 */
diff --git a/lib/libm/cosh.c b/lib/libm/cosh.c
index 7684d2fa..3dc5c618 100644
--- a/lib/libm/cosh.c
+++ b/lib/libm/cosh.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for __expo2, FORCE_EVAL
+
+#include <math.h> // for cosh, exp, expm1
+#include <stdint.h> // for uint64_t, uint32_t
/* cosh(x) = (exp(x) + 1/exp(x))/2
* = 1 + 0.5*(exp(x)-1)*(exp(x)-1)/exp(x)
diff --git a/lib/libm/coshf.c b/lib/libm/coshf.c
index 451e6928..e29a670f 100644
--- a/lib/libm/coshf.c
+++ b/lib/libm/coshf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for __expo2f, FORCE_EVAL
+
+#include <math.h> // for coshf, expf, expm1f
+#include <stdint.h> // for uint32_t
float coshf(float x)
{
diff --git a/lib/libm/coshl.c b/lib/libm/coshl.c
index d1eb74ae..538b192f 100644
--- a/lib/libm/coshl.c
+++ b/lib/libm/coshl.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expl, coshl, expm1l
+#include <stdint.h> // for uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double coshl(long double x)
diff --git a/lib/libm/cosl.c b/lib/libm/cosl.c
index 08e0d997..19f249f1 100644
--- a/lib/libm/cosl.c
+++ b/lib/libm/cosl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for __cosl, ldshape, __sinl, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for cosl, M_PI_4
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double cosl(long double x)
diff --git a/lib/libm/cpow.c b/lib/libm/cpow.c
index d4aff129..885421ee 100644
--- a/lib/libm/cpow.c
+++ b/lib/libm/cpow.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, I, cabs, carg, cimag, cpow, creal
+#include <math.h> // for cos, exp, log, pow, sin
double complex cpow(double complex a, double complex z)
{
diff --git a/lib/libm/cpowf.c b/lib/libm/cpowf.c
index 9bab4e8e..b63c6969 100644
--- a/lib/libm/cpowf.c
+++ b/lib/libm/cpowf.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, I, cabsf, cargf, cimagf, cpowf, crealf
+#include <math.h> // for cosf, expf, logf, powf, sinf
float complex cpowf(float complex a, float complex z)
{
diff --git a/lib/libm/cpowl.c b/lib/libm/cpowl.c
index b7471f0a..aa6141f8 100644
--- a/lib/libm/cpowl.c
+++ b/lib/libm/cpowl.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, I, cabsl, cargl, cimagl, cpowl, creall
+#include <math.h> // for cosl, expl, logl, powl, sinl
long double complex cpowl(long double complex a, long double complex z)
{
diff --git a/lib/libm/cproj.c b/lib/libm/cproj.c
index db16721f..d2db8af0 100644
--- a/lib/libm/cproj.c
+++ b/lib/libm/cproj.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, REAL_PART, double_complex
+
+#include <complex.h> // for cimag, complex, cproj, creal
+#include <math.h> // for copysign, isinf, INFINITY
double complex cproj(double complex z)
{
diff --git a/lib/libm/cprojl.c b/lib/libm/cprojl.c
index 80c675ca..b5035230 100644
--- a/lib/libm/cprojl.c
+++ b/lib/libm/cprojl.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, REAL_PART, long_double_complex
+
+#include <complex.h> // for cimagl, complex, cprojl, creall
+#include <math.h> // for copysignl, isinf, INFINITY
long double complex cprojl(long double complex z)
{
diff --git a/lib/libm/creal.c b/lib/libm/creal.c
index 03ec4c28..109a40bb 100644
--- a/lib/libm/creal.c
+++ b/lib/libm/creal.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for REAL_PART, double_complex
+
+#include <complex.h> // for creal, complex
double creal(double complex z)
{
diff --git a/lib/libm/crealf.c b/lib/libm/crealf.c
index e9b07f57..c1c1a6a1 100644
--- a/lib/libm/crealf.c
+++ b/lib/libm/crealf.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for REAL_PART, float_complex
+
+#include <complex.h> // for crealf, complex
float crealf(float complex z)
{
diff --git a/lib/libm/creall.c b/lib/libm/creall.c
index 4a340485..b6ce7ff0 100644
--- a/lib/libm/creall.c
+++ b/lib/libm/creall.c
@@ -1,4 +1,6 @@
-#include "__complex.h"
+#include "__complex.h" // for REAL_PART, long_double_complex
+
+#include <complex.h> // for creall, complex
long double creall(long double complex z)
{
diff --git a/lib/libm/csin.c b/lib/libm/csin.c
index 1299f10a..7c9b3b46 100644
--- a/lib/libm/csin.c
+++ b/lib/libm/csin.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for cchsh
+
+#include <complex.h> // for creal, complex, cimag, csin, I
+#include <math.h> // for cos, sin
double complex csin(double complex z)
{
diff --git a/lib/libm/csinf.c b/lib/libm/csinf.c
index 34d072b8..fb7c971b 100644
--- a/lib/libm/csinf.c
+++ b/lib/libm/csinf.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for cchshf
+
+#include <complex.h> // for crealf, cimagf, complex, csinf, I
+#include <math.h> // for cosf, sinf
float complex csinf(float complex z)
{
diff --git a/lib/libm/csinh.c b/lib/libm/csinh.c
index f03b61c0..276bd3a6 100644
--- a/lib/libm/csinh.c
+++ b/lib/libm/csinh.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, cimag, creal, csinh, I
+#include <math.h> // for cos, cosh, sin, sinh
double complex csinh(double complex z)
{
diff --git a/lib/libm/csinhf.c b/lib/libm/csinhf.c
index 695f170e..6f786284 100644
--- a/lib/libm/csinhf.c
+++ b/lib/libm/csinhf.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for cimagf, complex, crealf, csinhf, I
+#include <math.h> // for cosf, coshf, sinf, sinhf
float complex csinhf(float complex z)
{
diff --git a/lib/libm/csinhl.c b/lib/libm/csinhl.c
index 3b840339..a8a2e4f3 100644
--- a/lib/libm/csinhl.c
+++ b/lib/libm/csinhl.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, cimagl, creall, csinhl, I
+#include <math.h> // for coshl, cosl, sinhl, sinl
long double complex csinhl(long double complex z)
{
diff --git a/lib/libm/csinl.c b/lib/libm/csinl.c
index df049bcc..9793d4ad 100644
--- a/lib/libm/csinl.c
+++ b/lib/libm/csinl.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for cchshl
+
+#include <complex.h> // for creall, complex, cimagl, csinl, I
+#include <math.h> // for cosl, sinl
long double complex csinl(long double complex z)
{
diff --git a/lib/libm/csqrt.c b/lib/libm/csqrt.c
index e98cb7c6..77d61ec2 100644
--- a/lib/libm/csqrt.c
+++ b/lib/libm/csqrt.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for complex, I, cabs, cimag, creal, csqrt
+#include <math.h> // for fabs, sqrt
double complex csqrt(double complex z)
{
@@ -10,15 +11,13 @@ double complex csqrt(double complex z)
if (y == 0.0) {
if (x == 0.0) {
return 0.0 + y * (double complex)I;
- } else {
- r = fabs(x);
- r = sqrt(r);
- if (x < 0.0) {
- return 0.0 + r * (double complex)I;
- } else {
- return r + y * (double complex)I;
- }
}
+ r = fabs(x);
+ r = sqrt(r);
+ if (x < 0.0) {
+ return 0.0 + r * (double complex)I;
+ }
+ return r + y * (double complex)I;
}
if (x == 0.0) {
@@ -27,8 +26,7 @@ double complex csqrt(double complex z)
if (y > 0)
return r + r * (double complex)I;
- else
- return r - r * (double complex)I;
+ return r - r * (double complex)I;
}
if ((fabs(x) > 4.0) || (fabs(y) > 4.0)) {
@@ -55,6 +53,5 @@ double complex csqrt(double complex z)
if (y < 0)
return t - r * (double complex)I;
- else
- return t + r * (double complex)I;
+ return t + r * (double complex)I;
}
diff --git a/lib/libm/csqrtf.c b/lib/libm/csqrtf.c
index 4ea894ab..79d03f4d 100644
--- a/lib/libm/csqrtf.c
+++ b/lib/libm/csqrtf.c
@@ -1,4 +1,5 @@
-#include "__complex.h"
+#include <complex.h> // for I, complex, cabsf, cimagf, crealf, csqrtf
+#include <math.h> // for fabsf, sqrtf
float complex csqrtf(float complex z)
{
@@ -10,11 +11,11 @@ float complex csqrtf(float complex z)
if (y == 0.0f) {
if (x < 0.0f) {
return 0.0f + sqrtf(-x) * I;
- } else if (x == 0.0f) {
+ }
+ if (x == 0.0f) {
return (0.0f + y * I);
- } else {
- return sqrtf(x) + y * I;
}
+ return sqrtf(x) + y * I;
}
if (x == 0.0f) {
@@ -22,8 +23,7 @@ float complex csqrtf(float complex z)
r = sqrtf(0.5f * r);
if (y > 0)
return r + r * I;
- else
- return r - r * I;
+ return r - r * I;
}
if ((fabsf(x) > 4.0f) || (fabsf(y) > 4.0f)) {
@@ -50,6 +50,5 @@ float complex csqrtf(float complex z)
if (y < 0)
return t - r * I;
- else
- return t + r * I;
+ return t + r * I;
}
diff --git a/lib/libm/csqrtl.c b/lib/libm/csqrtl.c
index 335e51d6..94bf52f1 100644
--- a/lib/libm/csqrtl.c
+++ b/lib/libm/csqrtl.c
@@ -1,6 +1,7 @@
-#include <stdbool.h>
-#include <float.h>
-#include "__complex.h"
+#include <complex.h> // for complex, I, cimagl, creall, csqrtl
+#include <float.h> // for LDBL_MAX
+#include <math.h> // for fabsl, copysignl, hypotl, sqrtl, isinf, INFINITY
+#include <stdbool.h> // for bool, false, true
#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L)
#define cpackl(r, i) ((r) + (i) * (long double complex)I)
@@ -31,8 +32,7 @@ long double complex csqrtl(long double complex z)
*/
if (signbit(a))
return (cpackl(fabsl(b - b), copysignl(a, b)));
- else
- return (cpackl(a, copysignl(b - b, b)));
+ return (cpackl(a, copysignl(b - b, b)));
}
/*
* The remaining special case (b is NaN) is handled just fine by
@@ -57,6 +57,5 @@ long double complex csqrtl(long double complex z)
/* Rescale. */
if (scale)
return (result * 2.0L);
- else
- return (result);
+ return (result);
}
diff --git a/lib/libm/ctan.c b/lib/libm/ctan.c
index 2bc6156c..b06e60a6 100644
--- a/lib/libm/ctan.c
+++ b/lib/libm/ctan.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for redupi, MACHEP
+
+#include <complex.h> // for cimag, creal, complex, I, ctan
+#include <math.h> // for fabs, HUGE_VAL, cos, cosh, sin, sinh
double _ctans(double complex z)
{
diff --git a/lib/libm/ctanf.c b/lib/libm/ctanf.c
index fe117d7a..168abac2 100644
--- a/lib/libm/ctanf.c
+++ b/lib/libm/ctanf.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for redupif, MACHEPF
+
+#include <complex.h> // for cimagf, crealf, complex, I, ctanf
+#include <math.h> // for fabsf, HUGE_VALF, cosf, coshf, sinf, sinhf
static float _ctansf(float complex z)
{
diff --git a/lib/libm/ctanh.c b/lib/libm/ctanh.c
index a99e1496..e2d550df 100644
--- a/lib/libm/ctanh.c
+++ b/lib/libm/ctanh.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for complex, cimag, creal, ctanh, I
+#include <math.h> // for cos, cosh, sin, sinh
double complex ctanh(double complex z)
{
diff --git a/lib/libm/ctanhf.c b/lib/libm/ctanhf.c
index 6574e2c5..3ecd9ed9 100644
--- a/lib/libm/ctanhf.c
+++ b/lib/libm/ctanhf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for cimagf, complex, crealf, ctanhf, I
+#include <math.h> // for cosf, coshf, sinf, sinhf
float complex ctanhf(float complex z)
{
diff --git a/lib/libm/ctanhl.c b/lib/libm/ctanhl.c
index 9b798080..1c9b9b81 100644
--- a/lib/libm/ctanhl.c
+++ b/lib/libm/ctanhl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <complex.h>
+#include <complex.h> // for complex, cimagl, creall, ctanhl, I
+#include <math.h> // for coshl, cosl, sinhl, sinl
long double complex ctanhl(long double complex z)
{
diff --git a/lib/libm/ctanl.c b/lib/libm/ctanl.c
index a410db0e..65a9c2a5 100644
--- a/lib/libm/ctanl.c
+++ b/lib/libm/ctanl.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for ctansl
+
+#include <complex.h> // for cimagl, complex, creall, I, ctanl
+#include <math.h> // for HUGE_VALL, coshl, cosl, fabsl, sinhl, sinl
long double complex ctanl(long double complex z)
{
diff --git a/lib/libm/erf.c b/lib/libm/erf.c
index 4a096387..e95fb98c 100644
--- a/lib/libm/erf.c
+++ b/lib/libm/erf.c
@@ -103,7 +103,10 @@
* erfc/erf(NaN) is NaN
*/
-#include "libm.h"
+#include "libm.h" // for GET_HIGH_WORD, SET_LOW_WORD
+
+#include <math.h> // for double_t, exp, fabs, erf, erfc
+#include <stdint.h> // for uint32_t
static const double erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000
*/
diff --git a/lib/libm/erff.c b/lib/libm/erff.c
index 26170f62..2bf5d39e 100644
--- a/lib/libm/erff.c
+++ b/lib/libm/erff.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD, SET_FLOAT_WORD
+
+#include <math.h> // for float_t, expf, fabsf, erfcf, erff
+#include <stdint.h> // for uint32_t
static const float erx = 8.4506291151e-01, /* 0x3f58560b */
/*
diff --git a/lib/libm/erfl.c b/lib/libm/erfl.c
index d75acb24..bb571734 100644
--- a/lib/libm/erfl.c
+++ b/lib/libm/erfl.c
@@ -97,7 +97,11 @@
* erfc/erf(NaN) is NaN
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expl, fabsl, erfcl, erfl
+#include <stdint.h> // for uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double erfl(long double x)
diff --git a/lib/libm/exp.c b/lib/libm/exp.c
index cbcd7623..088a0cbb 100644
--- a/lib/libm/exp.c
+++ b/lib/libm/exp.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp_data.h"
+#include "exp_data.h" // for __exp_data, exp_data, EXP_POLY_ORDER, EXP_TABL...
+#include "libm.h" // for eval_as_double, asuint64, asdouble, WANT_ROUNDING
+
+#include <math.h> // for double_t, INFINITY, exp
+#include <stdint.h> // for uint64_t, uint32_t
#define N (1 << EXP_TABLE_BITS)
#define InvLn2N __exp_data.invln2N
@@ -91,8 +92,7 @@ double exp(double x)
return 1.0 + x;
if (asuint64(x) >> 63)
return __math_uflow(0);
- else
- return __math_oflow(0);
+ return __math_oflow(0);
}
/* Large x is special cased below. */
abstop = 0;
diff --git a/lib/libm/exp10.c b/lib/libm/exp10.c
index fd3747a9..deed9dcb 100644
--- a/lib/libm/exp10.c
+++ b/lib/libm/exp10.c
@@ -1,8 +1,8 @@
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for weak_alias
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for exp2, modf, pow
+#include <stdint.h> // for uint64_t
double exp10(double x)
{
diff --git a/lib/libm/exp10f.c b/lib/libm/exp10f.c
index 64883569..a9cde41d 100644
--- a/lib/libm/exp10f.c
+++ b/lib/libm/exp10f.c
@@ -1,8 +1,8 @@
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for weak_alias
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for exp2, exp2f, modff
+#include <stdint.h> // for uint32_t
float exp10f(float x)
{
diff --git a/lib/libm/exp10l.c b/lib/libm/exp10l.c
index 53915621..f0bf23d9 100644
--- a/lib/libm/exp10l.c
+++ b/lib/libm/exp10l.c
@@ -1,7 +1,8 @@
#define _GNU_SOURCE
-#include <float.h>
-#include <math.h>
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), weak_alias
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for exp2l, modfl, powl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double exp10l(long double x)
diff --git a/lib/libm/exp2.c b/lib/libm/exp2.c
index 1a4be99d..b94232fa 100644
--- a/lib/libm/exp2.c
+++ b/lib/libm/exp2.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp_data.h"
+#include "exp_data.h" // for __exp_data, exp_data, EXP_TABLE_BITS
+#include "libm.h" // for eval_as_double, asuint64, asdouble, WANT_ROUNDING
+
+#include <math.h> // for double_t, INFINITY, exp2
+#include <stdint.h> // for uint64_t, uint32_t
#define N (1 << EXP_TABLE_BITS)
#define Shift __exp_data.exp2_shift
@@ -88,7 +89,7 @@ double exp2(double x)
return 1.0 + x;
if (!(asuint64(x) >> 63))
return __math_oflow(0);
- else if (asuint64(x) >= asuint64(-1075.0))
+ if (asuint64(x) >= asuint64(-1075.0))
return __math_uflow(0);
}
if (2 * asuint64(x) > 2 * asuint64(928.0))
diff --git a/lib/libm/exp2f.c b/lib/libm/exp2f.c
index 8892cf8f..4b58ca8b 100644
--- a/lib/libm/exp2f.c
+++ b/lib/libm/exp2f.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp2f_data.h"
+#include "exp2f_data.h" // for __exp2f_data, exp2f_data, EXP2F_TABLE_BITS
+#include "libm.h" // for asuint, __math_oflowf, __math_uflowf, eval_a...
+
+#include <math.h> // for double_t, INFINITY, exp2f
+#include <stdint.h> // for uint32_t, uint64_t
/*
EXP2F_TABLE_BITS = 5
diff --git a/lib/libm/exp2f_data.h b/lib/libm/exp2f_data.h
index af31f629..8985ea21 100644
--- a/lib/libm/exp2f_data.h
+++ b/lib/libm/exp2f_data.h
@@ -5,7 +5,7 @@
#ifndef _EXP2F_DATA_H
#define _EXP2F_DATA_H
-#include <stdint.h>
+#include <stdint.h> // for uint64_t
#define hidden __attribute__((visibility("hidden")))
diff --git a/lib/libm/exp2l.c b/lib/libm/exp2l.c
index 6d21d590..d5899e2d 100644
--- a/lib/libm/exp2l.c
+++ b/lib/libm/exp2l.c
@@ -26,7 +26,11 @@
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for exp2l, scalbnl
+#include <stdint.h> // for uint32_t, int32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double exp2l(long double x)
diff --git a/lib/libm/exp_data.h b/lib/libm/exp_data.h
index 76f016ad..ce7f3803 100644
--- a/lib/libm/exp_data.h
+++ b/lib/libm/exp_data.h
@@ -5,7 +5,7 @@
#ifndef _EXP_DATA_H
#define _EXP_DATA_H
-#include <stdint.h>
+#include <stdint.h> // for uint64_t
#define hidden __attribute__((visibility("hidden")))
diff --git a/lib/libm/expf.c b/lib/libm/expf.c
index 53108c44..419bfe77 100644
--- a/lib/libm/expf.c
+++ b/lib/libm/expf.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp2f_data.h"
+#include "exp2f_data.h" // for __exp2f_data, exp2f_data, EXP2F_TABLE_BITS
+#include "libm.h" // for asuint, __math_oflowf, __math_uflowf, eval_a...
+
+#include <math.h> // for double_t, INFINITY, expf
+#include <stdint.h> // for uint32_t, uint64_t
/*
EXP2F_TABLE_BITS = 5
diff --git a/lib/libm/expl.c b/lib/libm/expl.c
index 85ac4f10..5499a3f3 100644
--- a/lib/libm/expl.c
+++ b/lib/libm/expl.c
@@ -65,7 +65,10 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expl, floorl, scalbnl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double expl(long double x)
diff --git a/lib/libm/expm1.c b/lib/libm/expm1.c
index 4ce99a4d..c4022188 100644
--- a/lib/libm/expm1.c
+++ b/lib/libm/expm1.c
@@ -104,7 +104,10 @@
* to produce the hexadecimal values shown.
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for double_t, expm1, isnan
+#include <stdint.h> // for uint64_t, uint32_t
static const double o_threshold = 7.09782712893383973096e+02, /* 0x40862E42,
0xFEFA39EF */
diff --git a/lib/libm/expm1f.c b/lib/libm/expm1f.c
index 7cc13b91..6c966f3d 100644
--- a/lib/libm/expm1f.c
+++ b/lib/libm/expm1f.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for float_t, expm1f
+#include <stdint.h> // for uint32_t
static const float ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
diff --git a/lib/libm/expm1l.c b/lib/libm/expm1l.c
index 959751bf..e26e19c5 100644
--- a/lib/libm/expm1l.c
+++ b/lib/libm/expm1l.c
@@ -47,7 +47,8 @@
* IEEE -45,+maxarg 200,000 1.2e-19 2.5e-20
*/
-#include "libm.h"
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expm1l, floorl, scalbnl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double expm1l(long double x)
diff --git a/lib/libm/fabs.c b/lib/libm/fabs.c
index deb2dc42..167041f6 100644
--- a/lib/libm/fabs.c
+++ b/lib/libm/fabs.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for fabs
+#include <stdint.h> // for uint64_t
double fabs(double x)
{
diff --git a/lib/libm/fabsf.c b/lib/libm/fabsf.c
index 712dab65..71ffea4a 100644
--- a/lib/libm/fabsf.c
+++ b/lib/libm/fabsf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for fabsf
+#include <stdint.h> // for uint32_t
float fabsf(float x)
{
diff --git a/lib/libm/fabsl.c b/lib/libm/fabsl.c
index 9ffe8bbf..9b344491 100644
--- a/lib/libm/fabsl.c
+++ b/lib/libm/fabsl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for fabsl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fabsl(long double x)
{
diff --git a/lib/libm/fdim.c b/lib/libm/fdim.c
index 95854606..64c865b1 100644
--- a/lib/libm/fdim.c
+++ b/lib/libm/fdim.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for fdim, isnan
double fdim(double x, double y)
{
diff --git a/lib/libm/fdimf.c b/lib/libm/fdimf.c
index 543c3648..a7fa6783 100644
--- a/lib/libm/fdimf.c
+++ b/lib/libm/fdimf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for fdimf, isnan
float fdimf(float x, float y)
{
diff --git a/lib/libm/fdiml.c b/lib/libm/fdiml.c
index 62e29b7d..771b59e9 100644
--- a/lib/libm/fdiml.c
+++ b/lib/libm/fdiml.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <float.h>
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for fdiml, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fdiml(long double x, long double y)
diff --git a/lib/libm/finite.c b/lib/libm/finite.c
index 25a0575f..d05cfbdb 100644
--- a/lib/libm/finite.c
+++ b/lib/libm/finite.c
@@ -1,5 +1,5 @@
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for isfinite
int finite(double x)
{
diff --git a/lib/libm/finitef.c b/lib/libm/finitef.c
index 2c4c7714..2efe2161 100644
--- a/lib/libm/finitef.c
+++ b/lib/libm/finitef.c
@@ -1,5 +1,5 @@
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for isfinite
int finitef(float x)
{
diff --git a/lib/libm/floor.c b/lib/libm/floor.c
index 9972a974..1c5d9698 100644
--- a/lib/libm/floor.c
+++ b/lib/libm/floor.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for double_t, floor
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
diff --git a/lib/libm/floorf.c b/lib/libm/floorf.c
index cd9e99bc..026e3569 100644
--- a/lib/libm/floorf.c
+++ b/lib/libm/floorf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for floorf
+#include <stdint.h> // for uint32_t
float floorf(float x)
{
diff --git a/lib/libm/floorl.c b/lib/libm/floorl.c
index a1e49c69..9b7f4761 100644
--- a/lib/libm/floorl.c
+++ b/lib/libm/floorl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for floorl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double floorl(long double x)
diff --git a/lib/libm/fma.c b/lib/libm/fma.c
index b657b02a..77bc7b3c 100644
--- a/lib/libm/fma.c
+++ b/lib/libm/fma.c
@@ -1,7 +1,7 @@
-#include <stdint.h>
-#include <float.h>
-#include <math.h>
-#include "atomic.h"
+#include <asm/atomic.h> // for a_clz_64
+#include <float.h> // for FLT_MIN, DBL_MIN
+#include <math.h> // for fma, scalbn, double_t
+#include <stdint.h> // for uint64_t, int64_t, uint32_t
#define ASUINT64(x) \
((union { \
@@ -20,12 +20,12 @@ struct num {
static struct num normalize(double x)
{
uint64_t ix = ASUINT64(x);
- int e = ix >> 52;
+ int e = (int)(ix >> 52);
int sign = e & 0x800;
e &= 0x7ff;
if (!e) {
ix = ASUINT64(x * 0x1p63);
- e = ix >> 52 & 0x7ff;
+ e = (int)(ix >> 52) & 0x7ff;
e = e ? e - 63 : 0x800;
}
ix &= (1ull << 52) - 1;
@@ -146,10 +146,10 @@ double fma(double x, double y, double z)
e -= d;
/* convert to double */
- int64_t i = rhi; /* i is in [1<<62,(1<<63)-1] */
+ int64_t i = (int64_t)rhi; /* i is in [1<<62,(1<<63)-1] */
if (sign)
i = -i;
- double r = i; /* |r| is in [0x1p62,0x1p63] */
+ double r = (double)i; /* |r| is in [0x1p62,0x1p63] */
if (e < -1022 - 62) {
/* result is subnormal before rounding */
@@ -159,34 +159,39 @@ double fma(double x, double y, double z)
c = -c;
if (r == c) {
/* min normal after rounding, underflow depends
- on arch behaviour which can be imitated by
- a double to float conversion */
- float fltmin = 0x0.ffffff8p-63 * FLT_MIN * r;
+ on arch behaviour which
+ can be imitated by a double to float
+ conversion */
+ float fltmin = (float)(0x0.ffffff8p-63) *
+ FLT_MIN * (float)r;
return DBL_MIN / FLT_MIN * fltmin;
}
/* one bit is lost when scaled, add another top bit to
- only round once at conversion if it is inexact */
+ only round once at conversion if
+ it is inexact */
if (rhi << 53) {
- i = rhi >> 1 | (rhi & 1) | 1ull << 62;
+ i = (int64_t)(rhi >> 1 | (rhi & 1) |
+ 1ull << 62);
if (sign)
i = -i;
- r = i;
+ r = (double)i;
r = 2 * r - c; /* remove top bit */
/* raise underflow portably, such that it
- cannot be optimized away */
+ cannot be optimized away
+ */
{
double_t tiny = DBL_MIN / FLT_MIN * r;
- r += (double)(tiny * tiny) * (r - r);
+ r += (double)(tiny * tiny);
}
}
} else {
/* only round once when scaled */
d = 10;
- i = (rhi >> d | !!(rhi << (64 - d))) << d;
+ i = (int64_t)((rhi >> d | !!(rhi << (64 - d))) << d);
if (sign)
i = -i;
- r = i;
+ r = (double)i;
}
}
return scalbn(r, e);
diff --git a/lib/libm/fmaf.c b/lib/libm/fmaf.c
index 1952b210..b940283d 100644
--- a/lib/libm/fmaf.c
+++ b/lib/libm/fmaf.c
@@ -25,9 +25,10 @@
* SUCH DAMAGE.
*/
-#include <fenv.h>
-#include <math.h>
-#include <stdint.h>
+
+#include <fenv.h> // for feraiseexcept, fetestexcept, feclearexcept
+#include <math.h> // for fmaf
+#include <stdint.h> // for uint64_t
/*
* Fused multiply-add: Compute x * y + z with a single rounding error.
diff --git a/lib/libm/fmal.c b/lib/libm/fmal.c
index 1eceafd4..8dd0ac61 100644
--- a/lib/libm/fmal.c
+++ b/lib/libm/fmal.c
@@ -25,16 +25,19 @@
* SUCH DAMAGE.
*/
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_MIN
+#include <math.h> // for nextafterl, scalbnl, frexpl, INFINITY, ilogbl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fmal(long double x, long double y, long double z)
{
return fma(x, y, z);
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#include <fenv.h>
+#include <fenv.h> // for feraiseexcept, fesetround, fetestexcept, fecl...
#if LDBL_MANT_DIG == 64
-#define LASTBIT(u) (u.i.m & 1)
+#define LASTBIT(u) ((u).i.m & 1)
#define SPLIT (0x1p32L + 1)
#elif LDBL_MANT_DIG == 113
#define LASTBIT(u) (u.i.lo & 1)
@@ -288,7 +291,6 @@ long double fmal(long double x, long double y, long double z)
adj = add_adjusted(r.lo, xy.lo);
if (spread + ilogbl(r.hi) > -16383)
return scalbnl(r.hi + adj, spread);
- else
- return add_and_denormalize(r.hi, adj, spread);
+ return add_and_denormalize(r.hi, adj, spread);
}
#endif
diff --git a/lib/libm/fmax.c b/lib/libm/fmax.c
index 94f0caa1..1b3ff4fd 100644
--- a/lib/libm/fmax.c
+++ b/lib/libm/fmax.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for signbit, fmax, isnan
double fmax(double x, double y)
{
diff --git a/lib/libm/fmaxf.c b/lib/libm/fmaxf.c
index 695d8179..6c464f4b 100644
--- a/lib/libm/fmaxf.c
+++ b/lib/libm/fmaxf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for signbit, fmaxf, isnan
float fmaxf(float x, float y)
{
diff --git a/lib/libm/fmaxl.c b/lib/libm/fmaxl.c
index 4b03158e..328ffcba 100644
--- a/lib/libm/fmaxl.c
+++ b/lib/libm/fmaxl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <float.h>
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for signbit, fmaxl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fmaxl(long double x, long double y)
diff --git a/lib/libm/fmin.c b/lib/libm/fmin.c
index 08a8fd17..42ab00a6 100644
--- a/lib/libm/fmin.c
+++ b/lib/libm/fmin.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for signbit, fmin, isnan
double fmin(double x, double y)
{
diff --git a/lib/libm/fminf.c b/lib/libm/fminf.c
index 3573c7de..43303a52 100644
--- a/lib/libm/fminf.c
+++ b/lib/libm/fminf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for signbit, fminf, isnan
float fminf(float x, float y)
{
diff --git a/lib/libm/fminl.c b/lib/libm/fminl.c
index 69bc24a7..087b87b5 100644
--- a/lib/libm/fminl.c
+++ b/lib/libm/fminl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <float.h>
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for signbit, fminl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fminl(long double x, long double y)
diff --git a/lib/libm/fmod.c b/lib/libm/fmod.c
index 21607a63..8b503827 100644
--- a/lib/libm/fmod.c
+++ b/lib/libm/fmod.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for fmod, isnan
+#include <stdint.h> // for uint64_t
double fmod(double x, double y)
{
diff --git a/lib/libm/fmodf.c b/lib/libm/fmodf.c
index 6bcd398c..9109be96 100644
--- a/lib/libm/fmodf.c
+++ b/lib/libm/fmodf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for fmodf, isnan
+#include <stdint.h> // for uint32_t
float fmodf(float x, float y)
{
diff --git a/lib/libm/fmodl.c b/lib/libm/fmodl.c
index 72111dc1..767a94f0 100644
--- a/lib/libm/fmodl.c
+++ b/lib/libm/fmodl.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for fmodl, isnan
+#include <stdint.h> // for uint64_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double fmodl(long double x, long double y)
diff --git a/lib/libm/frexp.c b/lib/libm/frexp.c
index 1148c7e9..4b8629f9 100644
--- a/lib/libm/frexp.c
+++ b/lib/libm/frexp.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for frexp
+#include <stdint.h> // for uint64_t
double frexp(double x, int *e)
{
@@ -16,7 +16,8 @@ double frexp(double x, int *e)
} else
*e = 0;
return x;
- } else if (ee == 0x7ff) {
+ }
+ if (ee == 0x7ff) {
return x;
}
diff --git a/lib/libm/frexpf.c b/lib/libm/frexpf.c
index 711129fb..9eb91c21 100644
--- a/lib/libm/frexpf.c
+++ b/lib/libm/frexpf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for frexpf
+#include <stdint.h> // for uint32_t
float frexpf(float x, int *e)
{
@@ -16,7 +16,8 @@ float frexpf(float x, int *e)
} else
*e = 0;
return x;
- } else if (ee == 0xff) {
+ }
+ if (ee == 0xff) {
return x;
}
diff --git a/lib/libm/frexpl.c b/lib/libm/frexpl.c
index 102ade25..e3a32c06 100644
--- a/lib/libm/frexpl.c
+++ b/lib/libm/frexpl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for frexpl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double frexpl(long double x, int *e)
@@ -18,7 +21,8 @@ long double frexpl(long double x, int *e)
} else
*e = 0;
return x;
- } else if (ee == 0x7fff) {
+ }
+ if (ee == 0x7fff) {
return x;
}
diff --git a/lib/libm/hypot.c b/lib/libm/hypot.c
index 5cee8345..744c7bb8 100644
--- a/lib/libm/hypot.c
+++ b/lib/libm/hypot.c
@@ -1,6 +1,6 @@
-#include <math.h>
-#include <stdint.h>
-#include <float.h>
+#include <float.h> // for FLT_EVAL_METHOD, LDBL_MANT_DIG
+#include <math.h> // for double_t, hypot, sqrt
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD > 1U && LDBL_MANT_DIG == 64
#define SPLIT (0x1p32 + 1)
diff --git a/lib/libm/hypotf.c b/lib/libm/hypotf.c
index 60186e9e..ee91a9af 100644
--- a/lib/libm/hypotf.c
+++ b/lib/libm/hypotf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for hypotf, sqrtf, float_t
+#include <stdint.h> // for uint32_t
float hypotf(float x, float y)
{
diff --git a/lib/libm/hypotl.c b/lib/libm/hypotl.c
index fb59067c..d37594d4 100644
--- a/lib/libm/hypotl.c
+++ b/lib/libm/hypotl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for hypotl, sqrtl, isinf
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double hypotl(long double x, long double y)
diff --git a/lib/libm/ilogb.c b/lib/libm/ilogb.c
index 3487d460..d5cdd469 100644
--- a/lib/libm/ilogb.c
+++ b/lib/libm/ilogb.c
@@ -1,5 +1,8 @@
-#include <limits.h>
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <limits.h> // for INT_MAX
+#include <math.h> // for ilogb, FP_ILOGB0, FP_ILOGBNAN
+#include <stdint.h> // for uint64_t
int ilogb(double x)
{
diff --git a/lib/libm/ilogbf.c b/lib/libm/ilogbf.c
index 07599896..ecd5de0a 100644
--- a/lib/libm/ilogbf.c
+++ b/lib/libm/ilogbf.c
@@ -1,5 +1,8 @@
-#include <limits.h>
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <limits.h> // for INT_MAX
+#include <math.h> // for ilogbf, FP_ILOGB0, FP_ILOGBNAN
+#include <stdint.h> // for uint32_t
int ilogbf(float x)
{
diff --git a/lib/libm/ilogbl.c b/lib/libm/ilogbl.c
index 3ddf29ca..5d626a79 100644
--- a/lib/libm/ilogbl.c
+++ b/lib/libm/ilogbl.c
@@ -1,5 +1,9 @@
-#include <limits.h>
-#include "libm.h"
+#include "libm.h" // for ldshape, FORCE_EVAL, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <limits.h> // for INT_MAX
+#include <math.h> // for ilogbl, FP_ILOGB0, FP_ILOGBNAN
+#include <stdint.h> // for uint64_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
int ilogbl(long double x)
diff --git a/lib/libm/j0.c b/lib/libm/j0.c
index be5df8ce..52d3f483 100644
--- a/lib/libm/j0.c
+++ b/lib/libm/j0.c
@@ -54,7 +54,10 @@
* 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.
*/
-#include "libm.h"
+#include "libm.h" // for GET_HIGH_WORD, EXTRACT_WORDS
+
+#include <math.h> // for double_t, cos, log, fabs, sin, sqrt, j0, y0
+#include <stdint.h> // for uint32_t
static double pzero(double), qzero(double);
diff --git a/lib/libm/j0f.c b/lib/libm/j0f.c
index 5c7ffcbc..46ffc758 100644
--- a/lib/libm/j0f.c
+++ b/lib/libm/j0f.c
@@ -13,8 +13,11 @@
* ====================================================
*/
+#include <math.h> // for float_t, cosf, logf, fabsf, sinf, sqrtf
+#include <stdint.h> // for uint32_t
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD
static float pzerof(float), qzerof(float);
diff --git a/lib/libm/j1.c b/lib/libm/j1.c
index 0762e739..839160c4 100644
--- a/lib/libm/j1.c
+++ b/lib/libm/j1.c
@@ -54,7 +54,10 @@
* by method mentioned above.
*/
-#include "libm.h"
+#include "libm.h" // for GET_HIGH_WORD, EXTRACT_WORDS
+
+#include <math.h> // for double_t, cos, fabs, log, sin, sqrt, j1, y1
+#include <stdint.h> // for uint32_t
static double pone(double), qone(double);
diff --git a/lib/libm/j1f.c b/lib/libm/j1f.c
index 1fec2690..6415ae14 100644
--- a/lib/libm/j1f.c
+++ b/lib/libm/j1f.c
@@ -13,8 +13,11 @@
* ====================================================
*/
+#include <math.h> // for float_t, cosf, fabsf, logf, sinf, sqrtf
+#include <stdint.h> // for uint32_t
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for GET_FLOAT_WORD
static float ponef(float), qonef(float);
diff --git a/lib/libm/jn.c b/lib/libm/jn.c
index a8515278..c79743a0 100644
--- a/lib/libm/jn.c
+++ b/lib/libm/jn.c
@@ -34,7 +34,10 @@
* values of n>1.
*/
-#include "libm.h"
+#include "libm.h" // for EXTRACT_WORDS, GET_HIGH_WORD
+
+#include <math.h> // for cos, sin, fabs, j0, j1, y1, sqrt, y0, log, jn, yn
+#include <stdint.h> // for uint32_t
static const double invsqrtpi = 5.64189583547756279280e-01; /* 0x3FE20DD7,
0x50429B6D */
diff --git a/lib/libm/ldexp.c b/lib/libm/ldexp.c
index f4d1cd6a..e1cb2acb 100644
--- a/lib/libm/ldexp.c
+++ b/lib/libm/ldexp.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ldexp, scalbn
double ldexp(double x, int n)
{
diff --git a/lib/libm/ldexpf.c b/lib/libm/ldexpf.c
index 3bad5f39..48422e32 100644
--- a/lib/libm/ldexpf.c
+++ b/lib/libm/ldexpf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ldexpf, scalbnf
float ldexpf(float x, int n)
{
diff --git a/lib/libm/ldexpl.c b/lib/libm/ldexpl.c
index fd145ccc..8d47c090 100644
--- a/lib/libm/ldexpl.c
+++ b/lib/libm/ldexpl.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ldexpl, scalbnl
long double ldexpl(long double x, int n)
{
diff --git a/lib/libm/lgamma.c b/lib/libm/lgamma.c
index 2fc9b478..bb8931fe 100644
--- a/lib/libm/lgamma.c
+++ b/lib/libm/lgamma.c
@@ -1,5 +1,6 @@
-#include <math.h>
-#include "libm.h"
+#include "libm.h" // for __lgamma_r, __signgam
+
+#include <math.h> // for lgamma
double lgamma(double x)
{
diff --git a/lib/libm/lgamma_r.c b/lib/libm/lgamma_r.c
index 6cb89858..d3f901ae 100644
--- a/lib/libm/lgamma_r.c
+++ b/lib/libm/lgamma_r.c
@@ -78,7 +78,10 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for __cos, __sin, __lgamma_r, weak_alias
+
+#include <math.h> // for log, double_t, floor
+#include <stdint.h> // for uint32_t, uint64_t
static const double pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18
*/
diff --git a/lib/libm/lgammaf.c b/lib/libm/lgammaf.c
index 2ae051d0..2da954d5 100644
--- a/lib/libm/lgammaf.c
+++ b/lib/libm/lgammaf.c
@@ -1,5 +1,6 @@
-#include <math.h>
-#include "libm.h"
+#include "libm.h" // for __lgammaf_r, __signgam
+
+#include <math.h> // for lgammaf
float lgammaf(float x)
{
diff --git a/lib/libm/lgammaf_r.c b/lib/libm/lgammaf_r.c
index b1a02fb8..7cb25578 100644
--- a/lib/libm/lgammaf_r.c
+++ b/lib/libm/lgammaf_r.c
@@ -13,7 +13,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __cosdf, __sindf, __lgammaf_r, weak_alias
+
+#include <math.h> // for logf, floorf, double_t
+#include <stdint.h> // for uint32_t
static const float pi = 3.1415927410e+00, /* 0x40490fdb */
a0 = 7.7215664089e-02, /* 0x3d9e233f */
diff --git a/lib/libm/lgammal.c b/lib/libm/lgammal.c
index 08835693..6c137e20 100644
--- a/lib/libm/lgammal.c
+++ b/lib/libm/lgammal.c
@@ -85,8 +85,12 @@
*
*/
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for logl, floorl, lgammal
+#include <stdint.h> // for uint32_t
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for ldshape, __cosl, __sinl, ldshape::(anonymous)
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double __lgammal_r(long double x, int *sg)
diff --git a/lib/libm/libm.a b/lib/libm/libm.a
index 036141da..ac371df8 100644
--- a/lib/libm/libm.a
+++ b/lib/libm/libm.a
Binary files differ
diff --git a/lib/libm/libm.h b/lib/libm/libm.h
index 6f57c128..5d37249e 100644
--- a/lib/libm/libm.h
+++ b/lib/libm/libm.h
@@ -1,9 +1,7 @@
#ifndef _LIBM_H
#define _LIBM_H
-#include <asm/fpmath.h>
#include <float.h>
-#include <math.h>
#include <stdint.h>
#define hidden __attribute__((visibility("hidden")))
@@ -346,6 +344,6 @@ hidden long double __math_invalidl(long double);
#endif
#define weak_alias(old, new) \
- extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
+ extern __typeof(old)(new) __attribute__((__weak__, __alias__(#old)))
#endif
diff --git a/lib/libm/llrint.c b/lib/libm/llrint.c
index 4f583ae5..e8dc4dc4 100644
--- a/lib/libm/llrint.c
+++ b/lib/libm/llrint.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for llrint, rint
/* uses LLONG_MAX > 2^53, see comments in lrint.c */
diff --git a/lib/libm/llrintf.c b/lib/libm/llrintf.c
index 96949a00..2ca15e36 100644
--- a/lib/libm/llrintf.c
+++ b/lib/libm/llrintf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for llrintf, rintf
/* uses LLONG_MAX > 2^24, see comments in lrint.c */
diff --git a/lib/libm/llrintl.c b/lib/libm/llrintl.c
index 05f4bc82..99e38781 100644
--- a/lib/libm/llrintl.c
+++ b/lib/libm/llrintl.c
@@ -1,6 +1,9 @@
-#include <limits.h>
-#include <fenv.h>
-#include "libm.h"
+
+
+#include <fenv.h> // for feclearexcept, fetestexcept
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <limits.h> // for LLONG_MAX, LLONG_MIN
+#include <math.h> // for llrintl, rintl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long long llrintl(long double x)
diff --git a/lib/libm/llround.c b/lib/libm/llround.c
index 4d94787d..73958710 100644
--- a/lib/libm/llround.c
+++ b/lib/libm/llround.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for llround, round
long long llround(double x)
{
diff --git a/lib/libm/llroundf.c b/lib/libm/llroundf.c
index 19eb77ee..0e41625a 100644
--- a/lib/libm/llroundf.c
+++ b/lib/libm/llroundf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for llroundf, roundf
long long llroundf(float x)
{
diff --git a/lib/libm/llroundl.c b/lib/libm/llroundl.c
index 2c2ee5ec..e344aa08 100644
--- a/lib/libm/llroundl.c
+++ b/lib/libm/llroundl.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for llroundl, roundl
long long llroundl(long double x)
{
diff --git a/lib/libm/log.c b/lib/libm/log.c
index 38c0ccc4..39d23cdd 100644
--- a/lib/libm/log.c
+++ b/lib/libm/log.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "log_data.h"
+#include "libm.h" // for asuint64, eval_as_double, predict_false, __mat...
+#include "log_data.h" // for __log_data, log_data, log_data::(anonymous)
+
+#include <math.h> // for double_t, log, INFINITY
+#include <stdint.h> // for uint64_t, uint32_t, int64_t
#define T __log_data.tab
#define T2 __log_data.tab2
diff --git a/lib/libm/log10.c b/lib/libm/log10.c
index 003df818..729ca4d6 100644
--- a/lib/libm/log10.c
+++ b/lib/libm/log10.c
@@ -17,8 +17,8 @@
* log10(x) = (f - f*f/2 + r)/log(10) + k*log10(2)
*/
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for double_t, log10
+#include <stdint.h> // for uint64_t, uint32_t
static const double ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b,
0x15200000 */
diff --git a/lib/libm/log10f.c b/lib/libm/log10f.c
index c4f9e2ca..4bf26544 100644
--- a/lib/libm/log10f.c
+++ b/lib/libm/log10f.c
@@ -13,8 +13,8 @@
* See comments in log10.c.
*/
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for float_t, log10f
+#include <stdint.h> // for uint32_t
static const float ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */
ivln10lo = -3.1689971365e-05, /* 0xb804ead9 */
diff --git a/lib/libm/log10l.c b/lib/libm/log10l.c
index f8546cdb..d462308f 100644
--- a/lib/libm/log10l.c
+++ b/lib/libm/log10l.c
@@ -57,7 +57,10 @@
* log domain: x < 0; returns MINLOG
*/
-#include "libm.h"
+#include "libm.h" // for __p1evll, __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for INFINITY, frexpl, log10l, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double log10l(long double x)
@@ -102,10 +105,10 @@ static const long double S[4] = {
};
/* log10(2) */
#define L102A 0.3125L
-#define L102B -1.1470004336018804786261e-2L
+#define L102B (-1.1470004336018804786261e-2L)
/* log10(e) */
#define L10EA 0.5L
-#define L10EB -6.5705518096748172348871e-2L
+#define L10EB (-6.5705518096748172348871e-2L)
#define SQRTH 0.70710678118654752440L
diff --git a/lib/libm/log1p.c b/lib/libm/log1p.c
index 1667260a..a02f9a5a 100644
--- a/lib/libm/log1p.c
+++ b/lib/libm/log1p.c
@@ -53,7 +53,10 @@
* See HP-15C Advanced Functions Handbook, p.193.
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for double_t, log1p
+#include <stdint.h> // for uint32_t, uint64_t
static const double ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
diff --git a/lib/libm/log1pf.c b/lib/libm/log1pf.c
index bdd702d1..95337a38 100644
--- a/lib/libm/log1pf.c
+++ b/lib/libm/log1pf.c
@@ -10,7 +10,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for float_t, log1pf
+#include <stdint.h> // for uint32_t
static const float ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
diff --git a/lib/libm/log1pl.c b/lib/libm/log1pl.c
index 6021ccf4..972e9467 100644
--- a/lib/libm/log1pl.c
+++ b/lib/libm/log1pl.c
@@ -48,7 +48,10 @@
* IEEE -1.0, 9.0 100000 8.2e-20 2.5e-20
*/
-#include "libm.h"
+#include "libm.h" // for __p1evll, __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for frexpl, log1pl, INFINITY, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double log1pl(long double x)
diff --git a/lib/libm/log2.c b/lib/libm/log2.c
index 21f31ec1..e240ac07 100644
--- a/lib/libm/log2.c
+++ b/lib/libm/log2.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "log2_data.h"
+#include "libm.h" // for asuint64, eval_as_double, asdouble, predict_f...
+#include "log2_data.h" // for __log2_data, log2_data, log2_data::(anonymous)
+
+#include <math.h> // for double_t, log2, INFINITY
+#include <stdint.h> // for uint64_t, uint32_t, int64_t
#define T __log2_data.tab
#define T2 __log2_data.tab2
diff --git a/lib/libm/log2f.c b/lib/libm/log2f.c
index edcb28c6..f838da32 100644
--- a/lib/libm/log2f.c
+++ b/lib/libm/log2f.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "log2f_data.h"
+#include "libm.h" // for __math_divzerof, __math_invalidf, asuint
+#include "log2f_data.h" // for __log2f_data, log2f_data, log2f_data::(anony...
+
+#include <math.h> // for double_t, log2f
+#include <stdint.h> // for uint32_t, int32_t
/*
LOG2F_TABLE_BITS = 4
diff --git a/lib/libm/log2l.c b/lib/libm/log2l.c
index 65fe6df0..bec1d02d 100644
--- a/lib/libm/log2l.c
+++ b/lib/libm/log2l.c
@@ -52,7 +52,10 @@
* [-10000, +10000].
*/
-#include "libm.h"
+#include "libm.h" // for __p1evll, __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for frexpl, log2l, INFINITY, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double log2l(long double x)
diff --git a/lib/libm/logb.c b/lib/libm/logb.c
index f36a9646..68895f7f 100644
--- a/lib/libm/logb.c
+++ b/lib/libm/logb.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ilogb, logb, isfinite
/*
special cases:
diff --git a/lib/libm/logbf.c b/lib/libm/logbf.c
index 2344ed3a..e664e597 100644
--- a/lib/libm/logbf.c
+++ b/lib/libm/logbf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ilogbf, logbf, isfinite
float logbf(float x)
{
diff --git a/lib/libm/logbl.c b/lib/libm/logbl.c
index 4d7348a0..40ea514d 100644
--- a/lib/libm/logbl.c
+++ b/lib/libm/logbl.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for ilogbl, logbl, isfinite
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double logbl(long double x)
{
diff --git a/lib/libm/logf.c b/lib/libm/logf.c
index 5db4edaf..16cff83e 100644
--- a/lib/libm/logf.c
+++ b/lib/libm/logf.c
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "logf_data.h"
+#include "libm.h" // for __math_divzerof, __math_invalidf, asuint, eva...
+#include "logf_data.h" // for __logf_data, logf_data, logf_data::(anonymous)
+
+#include <math.h> // for double_t, logf
+#include <stdint.h> // for uint32_t, int32_t
/*
LOGF_TABLE_BITS = 4
diff --git a/lib/libm/logl.c b/lib/libm/logl.c
index a46484fa..419f98b6 100644
--- a/lib/libm/logl.c
+++ b/lib/libm/logl.c
@@ -52,7 +52,10 @@
* [-10000, +10000].
*/
-#include "libm.h"
+#include "libm.h" // for __p1evll, __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for frexpl, logl, INFINITY, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double logl(long double x)
diff --git a/lib/libm/lrint.c b/lib/libm/lrint.c
index 5ddd5fa9..d4392dde 100644
--- a/lib/libm/lrint.c
+++ b/lib/libm/lrint.c
@@ -1,7 +1,6 @@
-#include <limits.h>
-#include <fenv.h>
-#include <math.h>
-#include "libm.h"
+
+#include <limits.h> // for LONG_MAX
+#include <math.h> // for lrint, rint
/*
If the result cannot be represented (overflow, nan), then
diff --git a/lib/libm/lrintf.c b/lib/libm/lrintf.c
index ca0b6a46..6c4f9ae4 100644
--- a/lib/libm/lrintf.c
+++ b/lib/libm/lrintf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for lrintf, rintf
/* uses LONG_MAX > 2^24, see comments in lrint.c */
diff --git a/lib/libm/lrintl.c b/lib/libm/lrintl.c
index 82ce6393..fc82d8a8 100644
--- a/lib/libm/lrintl.c
+++ b/lib/libm/lrintl.c
@@ -1,6 +1,9 @@
-#include <limits.h>
-#include <fenv.h>
-#include "libm.h"
+
+
+#include <fenv.h> // for feclearexcept, fetestexcept
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <limits.h> // for LONG_MAX, LONG_MIN
+#include <math.h> // for lrintl, rintl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long lrintl(long double x)
diff --git a/lib/libm/lround.c b/lib/libm/lround.c
index b8b79547..cda90a01 100644
--- a/lib/libm/lround.c
+++ b/lib/libm/lround.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for lround, round
long lround(double x)
{
diff --git a/lib/libm/lroundf.c b/lib/libm/lroundf.c
index c4707e7d..76a063be 100644
--- a/lib/libm/lroundf.c
+++ b/lib/libm/lroundf.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for lroundf, roundf
long lroundf(float x)
{
diff --git a/lib/libm/lroundl.c b/lib/libm/lroundl.c
index 094fdf64..45d74c64 100644
--- a/lib/libm/lroundl.c
+++ b/lib/libm/lroundl.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for lroundl, roundl
long lroundl(long double x)
{
diff --git a/lib/libm/modf.c b/lib/libm/modf.c
index 94fe5439..fd473871 100644
--- a/lib/libm/modf.c
+++ b/lib/libm/modf.c
@@ -1,4 +1,5 @@
-#include "libm.h"
+#include <math.h> // for modf
+#include <stdint.h> // for uint64_t
double modf(double x, double *iptr)
{
diff --git a/lib/libm/modff.c b/lib/libm/modff.c
index d40752ba..73a5a162 100644
--- a/lib/libm/modff.c
+++ b/lib/libm/modff.c
@@ -1,4 +1,5 @@
-#include "libm.h"
+#include <math.h> // for modff
+#include <stdint.h> // for uint32_t
float modff(float x, float *iptr)
{
diff --git a/lib/libm/modfl.c b/lib/libm/modfl.c
index d46ce9fb..2aecb410 100644
--- a/lib/libm/modfl.c
+++ b/lib/libm/modfl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for modfl, isnan
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double modfl(long double x, long double *iptr)
diff --git a/lib/libm/nan.c b/lib/libm/nan.c
index e0f545d4..905817ed 100644
--- a/lib/libm/nan.c
+++ b/lib/libm/nan.c
@@ -1,5 +1,5 @@
-#include <sys/cdefs.h>
-#include <math.h>
+#include <math.h> // for nan, NAN
+#include <sys/cdefs.h> // for __unused
double nan(const char *__unused s)
{
diff --git a/lib/libm/nanf.c b/lib/libm/nanf.c
index db7bff6e..476156b6 100644
--- a/lib/libm/nanf.c
+++ b/lib/libm/nanf.c
@@ -1,5 +1,5 @@
-#include <sys/cdefs.h>
-#include <math.h>
+#include <math.h> // for nanf, NAN
+#include <sys/cdefs.h> // for __unused
float nanf(const char *__unused s)
{
diff --git a/lib/libm/nanl.c b/lib/libm/nanl.c
index 6e3c1377..c3bc8e87 100644
--- a/lib/libm/nanl.c
+++ b/lib/libm/nanl.c
@@ -1,5 +1,5 @@
-#include <sys/cdefs.h>
-#include <math.h>
+#include <math.h> // for nanl, NAN
+#include <sys/cdefs.h> // for __unused
long double nanl(const char *__unused s)
{
diff --git a/lib/libm/nearbyint.c b/lib/libm/nearbyint.c
index b0ffcc8a..d075eac6 100644
--- a/lib/libm/nearbyint.c
+++ b/lib/libm/nearbyint.c
@@ -1,5 +1,7 @@
-#include <fenv.h>
-#include <math.h>
+
+
+#include <fenv.h> // for feclearexcept, fetestexcept
+#include <math.h> // for nearbyint, rint
/* nearbyint is the same as rint, but it must not raise the inexact exception */
diff --git a/lib/libm/nearbyintf.c b/lib/libm/nearbyintf.c
index c96002b0..a180ae22 100644
--- a/lib/libm/nearbyintf.c
+++ b/lib/libm/nearbyintf.c
@@ -1,5 +1,7 @@
-#include <fenv.h>
-#include <math.h>
+
+
+#include <fenv.h> // for feclearexcept, fetestexcept
+#include <math.h> // for nearbyintf, rintf
float nearbyintf(float x)
{
diff --git a/lib/libm/nearbyintl.c b/lib/libm/nearbyintl.c
index 7d97b661..fc19d84b 100644
--- a/lib/libm/nearbyintl.c
+++ b/lib/libm/nearbyintl.c
@@ -1,5 +1,7 @@
-#include <math.h>
-#include <float.h>
+
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for nearbyintl, rintl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double nearbyintl(long double x)
@@ -7,7 +9,8 @@ long double nearbyintl(long double x)
return nearbyint(x);
}
#else
-#include <fenv.h>
+#include <fenv.h> // for feclearexcept, fetestexcept
+
long double nearbyintl(long double x)
{
#ifdef FE_INEXACT
diff --git a/lib/libm/nextafter.c b/lib/libm/nextafter.c
index f00857c3..ebe15d8d 100644
--- a/lib/libm/nextafter.c
+++ b/lib/libm/nextafter.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for isnan, nextafter
+#include <stdint.h> // for uint64_t
double nextafter(double x, double y)
{
diff --git a/lib/libm/nextafterf.c b/lib/libm/nextafterf.c
index 912e1578..6de8cce3 100644
--- a/lib/libm/nextafterf.c
+++ b/lib/libm/nextafterf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for isnan, nextafterf
+#include <stdint.h> // for uint32_t
float nextafterf(float x, float y)
{
diff --git a/lib/libm/nextafterl.c b/lib/libm/nextafterl.c
index a50dd503..848dda11 100644
--- a/lib/libm/nextafterl.c
+++ b/lib/libm/nextafterl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for isnan, nextafterl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double nextafterl(long double x, long double y)
diff --git a/lib/libm/nexttoward.c b/lib/libm/nexttoward.c
index 2082dff1..e5dabb4a 100644
--- a/lib/libm/nexttoward.c
+++ b/lib/libm/nexttoward.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for signbit, isnan, nexttoward
+#include <stdint.h> // for uint64_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
double nexttoward(double x, long double y)
diff --git a/lib/libm/nexttowardf.c b/lib/libm/nexttowardf.c
index a342bc4c..b66fd4f3 100644
--- a/lib/libm/nexttowardf.c
+++ b/lib/libm/nexttowardf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for signbit, isnan, nexttowardf
+#include <stdint.h> // for uint32_t
float nexttowardf(float x, long double y)
{
diff --git a/lib/libm/nexttowardl.c b/lib/libm/nexttowardl.c
index 67a63403..b5bda05b 100644
--- a/lib/libm/nexttowardl.c
+++ b/lib/libm/nexttowardl.c
@@ -1,4 +1,4 @@
-#include <math.h>
+#include <math.h> // for nextafterl, nexttowardl
long double nexttowardl(long double x, long double y)
{
diff --git a/lib/libm/pow.c b/lib/libm/pow.c
index 63dcf5ca..f4f84703 100644
--- a/lib/libm/pow.c
+++ b/lib/libm/pow.c
@@ -5,11 +5,12 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp_data.h"
-#include "pow_data.h"
+#include "exp_data.h" // for __exp_data, exp_data, EXP_POLY_ORDER, EXP_TABL...
+#include "libm.h" // for asuint64, eval_as_double, asdouble, predict_false
+#include "pow_data.h" // for __pow_log_data, pow_log_data, pow_log_data::(a...
+
+#include <math.h> // for double_t, INFINITY, fabs, pow
+#include <stdint.h> // for uint64_t, uint32_t, int64_t
/*
Worst-case error: 0.54 ULP (~= ulperr_exp + 1024*Ln2*relerr_log*2^53)
@@ -187,8 +188,7 @@ static inline double exp_inline(double_t x, double_t xtail, uint32_t sign_bias)
/* Note: inf and nan are already handled. */
if (asuint64(x) >> 63)
return __math_uflow(sign_bias);
- else
- return __math_oflow(sign_bias);
+ return __math_oflow(sign_bias);
}
/* Large x is special cased below. */
abstop = 0;
@@ -318,8 +318,7 @@ double pow(double x, double y)
if (WANT_ROUNDING)
return ix > asuint64(1.0) ? 1.0 + y :
1.0 - y;
- else
- return 1.0;
+ return 1.0;
}
return (ix > asuint64(1.0)) == (topy < 0x800) ?
__math_oflow(0) :
diff --git a/lib/libm/powf.c b/lib/libm/powf.c
index d20bb6af..f93a5877 100644
--- a/lib/libm/powf.c
+++ b/lib/libm/powf.c
@@ -3,11 +3,12 @@
* SPDX-License-Identifier: MIT
*/
-#include <math.h>
-#include <stdint.h>
-#include "libm.h"
-#include "exp2f_data.h"
-#include "powf_data.h"
+#include "exp2f_data.h" // for __exp2f_data, exp2f_data, EXP2F_TABLE_BITS
+#include "libm.h" // for predict_false, asuint, asuint64, __math_inva...
+#include "powf_data.h" // for __powf_log2_data, powf_log2_data, powf_log2_...
+
+#include <math.h> // for double_t, powf, float_t
+#include <stdint.h> // for uint32_t, uint64_t, int32_t
/*
POWF_LOG2_POLY_ORDER = 5
diff --git a/lib/libm/powf_data.h b/lib/libm/powf_data.h
index 5b136e28..951f28f2 100644
--- a/lib/libm/powf_data.h
+++ b/lib/libm/powf_data.h
@@ -5,8 +5,7 @@
#ifndef _POWF_DATA_H
#define _POWF_DATA_H
-#include "libm.h"
-#include "exp2f_data.h"
+#include "libm.h" // for TOINT_INTRINSICS, hidden
#define POWF_LOG2_TABLE_BITS 4
#define POWF_LOG2_POLY_ORDER 5
diff --git a/lib/libm/powl.c b/lib/libm/powl.c
index 1a2d48c8..26a9b5ae 100644
--- a/lib/libm/powl.c
+++ b/lib/libm/powl.c
@@ -59,7 +59,10 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for __polevll, __p1evll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON, LDBL_M...
+#include <math.h> // for INFINITY, fabsl, floorl, frexpl, isnan, powl, sca...
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double powl(long double x, long double y)
diff --git a/lib/libm/projf.c b/lib/libm/projf.c
index a0bcf369..a04de5cc 100644
--- a/lib/libm/projf.c
+++ b/lib/libm/projf.c
@@ -1,4 +1,7 @@
-#include "__complex.h"
+#include "__complex.h" // for IMAG_PART, REAL_PART, float_complex
+
+#include <complex.h> // for cimagf, complex, cprojf, crealf
+#include <math.h> // for copysignf, isinf, INFINITY
float complex cprojf(float complex z)
{
diff --git a/lib/libm/remainder.c b/lib/libm/remainder.c
index 53b5c8f6..35f20ea5 100644
--- a/lib/libm/remainder.c
+++ b/lib/libm/remainder.c
@@ -1,6 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for weak_alias
-#include <math.h>
+#include <math.h> // for remainder, remquo
double remainder(double x, double y)
{
diff --git a/lib/libm/remainderf.c b/lib/libm/remainderf.c
index 6a80a25c..375fa528 100644
--- a/lib/libm/remainderf.c
+++ b/lib/libm/remainderf.c
@@ -1,6 +1,6 @@
-#include "libm.h"
+#include "libm.h" // for weak_alias
-#include <math.h>
+#include <math.h> // for remainderf, remquof
float remainderf(float x, float y)
{
diff --git a/lib/libm/remainderl.c b/lib/libm/remainderl.c
index 2a13c1d5..270987df 100644
--- a/lib/libm/remainderl.c
+++ b/lib/libm/remainderl.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <float.h>
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for remainderl, remquol
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double remainderl(long double x, long double y)
diff --git a/lib/libm/remquo.c b/lib/libm/remquo.c
index a412f8e1..8e27914f 100644
--- a/lib/libm/remquo.c
+++ b/lib/libm/remquo.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for remquo, isnan
+#include <stdint.h> // for uint64_t, uint32_t
double remquo(double x, double y, int *quo)
{
diff --git a/lib/libm/remquof.c b/lib/libm/remquof.c
index 82124c65..c50b1615 100644
--- a/lib/libm/remquof.c
+++ b/lib/libm/remquof.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for remquof, isnan
+#include <stdint.h> // for uint32_t
float remquof(float x, float y, int *quo)
{
diff --git a/lib/libm/remquol.c b/lib/libm/remquol.c
index 23c88487..1a58f2d3 100644
--- a/lib/libm/remquol.c
+++ b/lib/libm/remquol.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for remquol, isnan
+#include <stdint.h> // for uint64_t, uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double remquol(long double x, long double y, int *quo)
diff --git a/lib/libm/rint.c b/lib/libm/rint.c
index f1159643..a1c64ea3 100644
--- a/lib/libm/rint.c
+++ b/lib/libm/rint.c
@@ -1,6 +1,6 @@
-#include <float.h>
-#include <math.h>
-#include <stdint.h>
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for double_t, rint
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
diff --git a/lib/libm/rintf.c b/lib/libm/rintf.c
index 5db9e0fe..6de51a6e 100644
--- a/lib/libm/rintf.c
+++ b/lib/libm/rintf.c
@@ -1,6 +1,6 @@
-#include <float.h>
-#include <math.h>
-#include <stdint.h>
+#include <float.h> // for FLT_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for float_t, rintf
+#include <stdint.h> // for uint32_t
#if FLT_EVAL_METHOD == 0
#define EPS FLT_EPSILON
diff --git a/lib/libm/rintl.c b/lib/libm/rintl.c
index e75fe870..acb68783 100644
--- a/lib/libm/rintl.c
+++ b/lib/libm/rintl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for rintl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double rintl(long double x)
diff --git a/lib/libm/round.c b/lib/libm/round.c
index aa36cce4..f23364c4 100644
--- a/lib/libm/round.c
+++ b/lib/libm/round.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <float.h> // for DBL_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for double_t, round
+#include <stdint.h> // for uint64_t
#if FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1
#define EPS DBL_EPSILON
diff --git a/lib/libm/roundf.c b/lib/libm/roundf.c
index fef6a24b..3df4c83b 100644
--- a/lib/libm/roundf.c
+++ b/lib/libm/roundf.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <float.h> // for FLT_EPSILON, FLT_EVAL_METHOD
+#include <math.h> // for float_t, roundf
+#include <stdint.h> // for uint32_t
#if FLT_EVAL_METHOD == 0
#define EPS FLT_EPSILON
diff --git a/lib/libm/roundl.c b/lib/libm/roundl.c
index cb148310..94b3aa89 100644
--- a/lib/libm/roundl.c
+++ b/lib/libm/roundl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for roundl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double roundl(long double x)
diff --git a/lib/libm/scalb.c b/lib/libm/scalb.c
index 478dd2ae..f5aeebfa 100644
--- a/lib/libm/scalb.c
+++ b/lib/libm/scalb.c
@@ -16,7 +16,7 @@
*/
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for scalbn, isnan, rint, isfinite
double scalb(double x, double fn)
{
@@ -25,8 +25,7 @@ double scalb(double x, double fn)
if (!isfinite(fn)) {
if (fn > 0.0)
return x * fn;
- else
- return x / (-fn);
+ return x / (-fn);
}
if (rint(fn) != fn)
return (fn - fn) / (fn - fn);
diff --git a/lib/libm/scalbf.c b/lib/libm/scalbf.c
index 7a938de2..bbe9549b 100644
--- a/lib/libm/scalbf.c
+++ b/lib/libm/scalbf.c
@@ -14,7 +14,7 @@
*/
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for scalbnf, isnan, rintf, isfinite
float scalbf(float x, float fn)
{
@@ -23,8 +23,7 @@ float scalbf(float x, float fn)
if (!isfinite(fn)) {
if (fn > 0.0f)
return x * fn;
- else
- return x / (-fn);
+ return x / (-fn);
}
if (rintf(fn) != fn)
return (fn - fn) / (fn - fn);
diff --git a/lib/libm/scalbln.c b/lib/libm/scalbln.c
index e6f3f195..78685eba 100644
--- a/lib/libm/scalbln.c
+++ b/lib/libm/scalbln.c
@@ -1,5 +1,5 @@
-#include <limits.h>
-#include <math.h>
+#include <limits.h> // for INT_MAX, INT_MIN
+#include <math.h> // for scalbln, scalbn
double scalbln(double x, long n)
{
diff --git a/lib/libm/scalblnf.c b/lib/libm/scalblnf.c
index d8e8166b..5c9d349d 100644
--- a/lib/libm/scalblnf.c
+++ b/lib/libm/scalblnf.c
@@ -1,5 +1,5 @@
-#include <limits.h>
-#include <math.h>
+#include <limits.h> // for INT_MAX, INT_MIN
+#include <math.h> // for scalblnf, scalbnf
float scalblnf(float x, long n)
{
diff --git a/lib/libm/scalblnl.c b/lib/libm/scalblnl.c
index 854c51c4..58a3f291 100644
--- a/lib/libm/scalblnl.c
+++ b/lib/libm/scalblnl.c
@@ -1,6 +1,6 @@
-#include <limits.h>
-#include <math.h>
-#include <float.h>
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <limits.h> // for INT_MAX, INT_MIN
+#include <math.h> // for scalblnl, scalbnl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double scalblnl(long double x, long n)
diff --git a/lib/libm/scalbn.c b/lib/libm/scalbn.c
index d38d4338..7dc1b156 100644
--- a/lib/libm/scalbn.c
+++ b/lib/libm/scalbn.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for scalbn, double_t
+#include <stdint.h> // for uint64_t
double scalbn(double x, int n)
{
diff --git a/lib/libm/scalbnf.c b/lib/libm/scalbnf.c
index 38b7d5b3..f0526a47 100644
--- a/lib/libm/scalbnf.c
+++ b/lib/libm/scalbnf.c
@@ -1,5 +1,5 @@
-#include <math.h>
-#include <stdint.h>
+#include <math.h> // for scalbnf, float_t
+#include <stdint.h> // for uint32_t
float scalbnf(float x, int n)
{
diff --git a/lib/libm/scalbnl.c b/lib/libm/scalbnl.c
index db44dab0..2312d669 100644
--- a/lib/libm/scalbnl.c
+++ b/lib/libm/scalbnl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for scalbnl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double scalbnl(long double x, int n)
diff --git a/lib/libm/signgam.c b/lib/libm/signgam.c
index ee331b27..2f4b82f9 100644
--- a/lib/libm/signgam.c
+++ b/lib/libm/signgam.c
@@ -1,5 +1,6 @@
-#include <math.h>
-#include "libm.h"
+#include "libm.h" // for __signgam, weak_alias
+
+#include <math.h> // for signgam
int __signgam = 0;
diff --git a/lib/libm/significand.c b/lib/libm/significand.c
index 40d9aa9f..744c0c65 100644
--- a/lib/libm/significand.c
+++ b/lib/libm/significand.c
@@ -1,5 +1,5 @@
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for ilogb, scalbn
double significand(double x)
{
diff --git a/lib/libm/significandf.c b/lib/libm/significandf.c
index 8a697e1a..43f0d096 100644
--- a/lib/libm/significandf.c
+++ b/lib/libm/significandf.c
@@ -1,5 +1,5 @@
#define _GNU_SOURCE
-#include <math.h>
+#include <math.h> // for ilogbf, scalbnf
float significandf(float x)
{
diff --git a/lib/libm/sin.c b/lib/libm/sin.c
index d836c705..4eff1001 100644
--- a/lib/libm/sin.c
+++ b/lib/libm/sin.c
@@ -40,7 +40,10 @@
* TRIG(x) returns trig(x) nearly rounded
*/
-#include "libm.h"
+#include "libm.h" // for __sin, __cos, __rem_pio2, FORCE_EVAL, GET_HIGH_WORD
+
+#include <math.h> // for sin
+#include <stdint.h> // for uint32_t
double sin(double x)
{
diff --git a/lib/libm/sincos.c b/lib/libm/sincos.c
index 50f22f46..c7300d7b 100644
--- a/lib/libm/sincos.c
+++ b/lib/libm/sincos.c
@@ -10,8 +10,10 @@
* ====================================================
*/
+#include <stdint.h> // for uint32_t
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for __cos, __sin, __rem_pio2, FORCE_EVAL, GET_HIGH_WORD
void sincos(double x, double *sin, double *cos)
{
diff --git a/lib/libm/sincosf.c b/lib/libm/sincosf.c
index 359c41cb..ea4bc567 100644
--- a/lib/libm/sincosf.c
+++ b/lib/libm/sincosf.c
@@ -14,8 +14,11 @@
* ====================================================
*/
+#include <math.h> // for M_PI_2, float_t
+#include <stdint.h> // for uint32_t
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for __cosdf, __sindf, __rem_pio2f, FORCE_EVAL, GET_F...
/* Small multiples of pi/2 rounded to double precision. */
static const double s1pio2 = 1 * M_PI_2, /* 0x3FF921FB, 0x54442D18 */
diff --git a/lib/libm/sincosl.c b/lib/libm/sincosl.c
index 21b19945..1dcba70b 100644
--- a/lib/libm/sincosl.c
+++ b/lib/libm/sincosl.c
@@ -1,5 +1,9 @@
+#include "math.h" // for M_PI_4
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+
#define _GNU_SOURCE
-#include "libm.h"
+#include "libm.h" // for ldshape, __cosl, __sinl, ldshape::(anonymous)
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
void sincosl(long double x, long double *sin, long double *cos)
diff --git a/lib/libm/sinf.c b/lib/libm/sinf.c
index f835ef8a..28513976 100644
--- a/lib/libm/sinf.c
+++ b/lib/libm/sinf.c
@@ -14,7 +14,10 @@
* ====================================================
*/
-#include "libm.h"
+#include "libm.h" // for __cosdf, __sindf, __rem_pio2f, FORCE_EVAL, GET_F...
+
+#include <math.h> // for M_PI_2, sinf
+#include <stdint.h> // for uint32_t
/* Small multiples of pi/2 rounded to double precision. */
static const double s1pio2 = 1 * M_PI_2, /* 0x3FF921FB, 0x54442D18 */
@@ -45,8 +48,7 @@ float sinf(float x)
if (ix <= 0x4016cbe3) { /* |x| ~<= 3pi/4 */
if (sign)
return -__cosdf(x + s1pio2);
- else
- return __cosdf(x - s1pio2);
+ return __cosdf(x - s1pio2);
}
return __sindf(sign ? -(x + s2pio2) : -(x - s2pio2));
}
@@ -54,8 +56,7 @@ float sinf(float x)
if (ix <= 0x40afeddf) { /* |x| ~<= 7*pi/4 */
if (sign)
return __cosdf(x + s3pio2);
- else
- return -__cosdf(x - s3pio2);
+ return -__cosdf(x - s3pio2);
}
return __sindf(sign ? x + s4pio2 : x - s4pio2);
}
diff --git a/lib/libm/sinh.c b/lib/libm/sinh.c
index b2b6e813..1c238c05 100644
--- a/lib/libm/sinh.c
+++ b/lib/libm/sinh.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for __expo2
+
+#include <math.h> // for expm1, sinh
+#include <stdint.h> // for uint64_t, uint32_t
/* sinh(x) = (exp(x) - 1/exp(x))/2
* = (exp(x)-1 + (exp(x)-1)/exp(x))/2
diff --git a/lib/libm/sinhf.c b/lib/libm/sinhf.c
index e5bd1a2a..8636c156 100644
--- a/lib/libm/sinhf.c
+++ b/lib/libm/sinhf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for __expo2f
+
+#include <math.h> // for expm1f, sinhf
+#include <stdint.h> // for uint32_t
float sinhf(float x)
{
diff --git a/lib/libm/sinhl.c b/lib/libm/sinhl.c
index 55dc20a2..fa35e870 100644
--- a/lib/libm/sinhl.c
+++ b/lib/libm/sinhl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expl, expm1l, sinhl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double sinhl(long double x)
diff --git a/lib/libm/sinl.c b/lib/libm/sinl.c
index bb1352f1..3c650851 100644
--- a/lib/libm/sinl.c
+++ b/lib/libm/sinl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), __sinl, __cosl
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for sinl, M_PI_4
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double sinl(long double x)
diff --git a/lib/libm/sqrt.c b/lib/libm/sqrt.c
index 9c54b70c..185a1190 100644
--- a/lib/libm/sqrt.c
+++ b/lib/libm/sqrt.c
@@ -1,7 +1,8 @@
-#include <stdint.h>
-#include <math.h>
-#include "libm.h"
-#include "sqrt_data.h"
+#include "libm.h" // for __math_invalid, asdouble, asuint64, eval_as_d...
+#include "sqrt_data.h" // for __rsqrt_tab
+
+#include <math.h> // for sqrt
+#include <stdint.h> // for uint64_t, uint32_t
#define FENV_SUPPORT 1
diff --git a/lib/libm/sqrt_data.c b/lib/libm/sqrt_data.c
index 4b15ae2b..4dc20a17 100644
--- a/lib/libm/sqrt_data.c
+++ b/lib/libm/sqrt_data.c
@@ -1,4 +1,7 @@
#include "sqrt_data.h"
+
+#include <stdint.h> // for uint16_t
+
const uint16_t __rsqrt_tab[128] = {
0xb451, 0xb2f0, 0xb196, 0xb044, 0xaef9, 0xadb6, 0xac79, 0xab43, 0xaa14,
0xa8eb, 0xa7c8, 0xa6aa, 0xa592, 0xa480, 0xa373, 0xa26b, 0xa168, 0xa06a,
diff --git a/lib/libm/sqrt_data.h b/lib/libm/sqrt_data.h
index f5929b8d..feff8a8b 100644
--- a/lib/libm/sqrt_data.h
+++ b/lib/libm/sqrt_data.h
@@ -1,7 +1,7 @@
#ifndef _SQRT_DATA_H
#define _SQRT_DATA_H
-#include <stdint.h>
+#include <stdint.h> // for uint16_t
#define hidden __attribute__((visibility("hidden")))
diff --git a/lib/libm/sqrtf.c b/lib/libm/sqrtf.c
index b9cd7961..e507455c 100644
--- a/lib/libm/sqrtf.c
+++ b/lib/libm/sqrtf.c
@@ -1,7 +1,8 @@
-#include <stdint.h>
-#include <math.h>
-#include "libm.h"
-#include "sqrt_data.h"
+#include "libm.h" // for __math_invalidf, asfloat, asuint, eval_as_float
+#include "sqrt_data.h" // for __rsqrt_tab
+
+#include <math.h> // for sqrtf
+#include <stdint.h> // for uint32_t, uint64_t
#define FENV_SUPPORT 1
diff --git a/lib/libm/sqrtl.c b/lib/libm/sqrtl.c
index 57249e9f..d71d455e 100644
--- a/lib/libm/sqrtl.c
+++ b/lib/libm/sqrtl.c
@@ -1,7 +1,8 @@
-#include <stdint.h>
-#include <math.h>
-#include <float.h>
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), __math_invalidl
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for sqrtl
+#include <stdint.h> // for uint64_t, uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double sqrtl(long double x)
@@ -9,7 +10,7 @@ long double sqrtl(long double x)
return sqrt(x);
}
#elif (LDBL_MANT_DIG == 113 || LDBL_MANT_DIG == 64) && LDBL_MAX_EXP == 16384
-#include "sqrt_data.h"
+#include "sqrt_data.h" // for __rsqrt_tab
#define FENV_SUPPORT 1
diff --git a/lib/libm/tan.c b/lib/libm/tan.c
index ecdf5515..5f37becc 100644
--- a/lib/libm/tan.c
+++ b/lib/libm/tan.c
@@ -39,7 +39,10 @@
* TRIG(x) returns trig(x) nearly rounded
*/
-#include "libm.h"
+#include "libm.h" // for __tan, __rem_pio2, FORCE_EVAL, GET_HIGH_WORD
+
+#include <math.h> // for tan
+#include <stdint.h> // for uint32_t
double tan(double x)
{
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);
diff --git a/lib/libm/tanh.c b/lib/libm/tanh.c
index b32bf0b6..2b0951fd 100644
--- a/lib/libm/tanh.c
+++ b/lib/libm/tanh.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for expm1, tanh, double_t
+#include <stdint.h> // for uint64_t, uint32_t
/* tanh(x) = (exp(x) - exp(-x))/(exp(x) + exp(-x))
* = (exp(2*x) - 1)/(exp(2*x) - 1 + 2)
@@ -15,7 +18,7 @@ double tanh(double x)
double_t t;
/* x = |x| */
- sign = u.i >> 63;
+ sign = (int)(u.i >> 63);
u.i &= (uint64_t)-1 / 2;
x = u.f;
w = u.i >> 32;
diff --git a/lib/libm/tanhf.c b/lib/libm/tanhf.c
index f4ae759d..d8ec3aa3 100644
--- a/lib/libm/tanhf.c
+++ b/lib/libm/tanhf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for expm1f, tanhf
+#include <stdint.h> // for uint32_t
float tanhf(float x)
{
@@ -7,7 +10,7 @@ float tanhf(float x)
uint32_t i;
} u = { .f = x };
uint32_t w;
- int sign;
+ uint32_t sign;
float t;
/* x = |x| */
diff --git a/lib/libm/tanhl.c b/lib/libm/tanhl.c
index a5be4a68..b302f34f 100644
--- a/lib/libm/tanhl.c
+++ b/lib/libm/tanhl.c
@@ -1,4 +1,8 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous)
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for expm1l, tanhl
+#include <stdint.h> // for uint32_t
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double tanhl(long double x)
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
diff --git a/lib/libm/tgamma.c b/lib/libm/tgamma.c
index afc15b4b..69759fd8 100644
--- a/lib/libm/tgamma.c
+++ b/lib/libm/tgamma.c
@@ -22,7 +22,10 @@ Gamma(x)*Gamma(-x) = -pi/(x sin(pi x))
most ideas and constants are from boost and python
*/
-#include "libm.h"
+#include "libm.h" // for __cos, __sin, FORCE_EVAL
+
+#include <math.h> // for floor, double_t, exp, pow, tgamma, INFINITY
+#include <stdint.h> // for uint32_t, uint64_t
static const double pi = 3.141592653589793238462643383279502884;
@@ -37,7 +40,7 @@ static double sinpi(double x)
x = 2 * (x - floor(x));
/* reduce x into [-.25,.25] */
- n = 4 * x;
+ n = (int)(4 * x);
n = (n + 1) / 2;
x -= n * 0.5;
@@ -132,8 +135,8 @@ double tgamma(double x)
} u = { x };
double absx, y;
double_t dy, z, r;
- uint32_t ix = u.i >> 32 & 0x7fffffff;
- int sign = u.i >> 63;
+ uint32_t ix = (uint32_t)(u.i >> 32) & 0x7fffffff;
+ int sign = (int)(u.i >> 63);
/* special cases */
if (ix >= 0x7ff00000)
@@ -149,7 +152,7 @@ double tgamma(double x)
if (x == floor(x)) {
if (sign)
return 0 / 0.0;
- if (x <= sizeof fact / sizeof *fact)
+ if (x <= ((double)sizeof(fact) / (double)(sizeof *fact)))
return fact[(int)x - 1];
}
diff --git a/lib/libm/tgammaf.c b/lib/libm/tgammaf.c
index b4ca51c9..650f8dd7 100644
--- a/lib/libm/tgammaf.c
+++ b/lib/libm/tgammaf.c
@@ -1,6 +1,6 @@
-#include <math.h>
+#include <math.h> // for tgamma, tgammaf
float tgammaf(float x)
{
- return tgamma(x);
+ return (float)tgamma((double)x);
}
diff --git a/lib/libm/tgammal.c b/lib/libm/tgammal.c
index 1ebbfab8..54270091 100644
--- a/lib/libm/tgammal.c
+++ b/lib/libm/tgammal.c
@@ -48,7 +48,10 @@
*
*/
-#include "libm.h"
+#include "libm.h" // for __polevll
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP
+#include <math.h> // for fabsl, floorl, powl, expl, sinl, tgammal, INFINITY
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double tgammal(long double x)
@@ -250,7 +253,7 @@ long double tgammal(long double x)
small:
/* z==1 if x was originally +-0 */
if (x == 0 && z != 1)
- return x / x;
+ return NAN;
if (x < 0.0) {
x = -x;
q = z / (x * __polevll(x, SN, 8));
diff --git a/lib/libm/trunc.c b/lib/libm/trunc.c
index d76f9993..4e5fa18b 100644
--- a/lib/libm/trunc.c
+++ b/lib/libm/trunc.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for trunc
+#include <stdint.h> // for uint64_t
double trunc(double x)
{
diff --git a/lib/libm/truncf.c b/lib/libm/truncf.c
index 4cdf082e..fc44f6c7 100644
--- a/lib/libm/truncf.c
+++ b/lib/libm/truncf.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for FORCE_EVAL
+
+#include <math.h> // for truncf
+#include <stdint.h> // for uint32_t
float truncf(float x)
{
diff --git a/lib/libm/truncl.c b/lib/libm/truncl.c
index 00e459ce..1771e33c 100644
--- a/lib/libm/truncl.c
+++ b/lib/libm/truncl.c
@@ -1,4 +1,7 @@
-#include "libm.h"
+#include "libm.h" // for ldshape, ldshape::(anonymous), FORCE_EVAL
+
+#include <float.h> // for LDBL_MANT_DIG, LDBL_MAX_EXP, LDBL_EPSILON
+#include <math.h> // for truncl
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double truncl(long double x)