mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 20:21:07 +00:00
55a38f8236
TS 18661-1 defines llogb functions that are like ilogb except that they return long int instead of int. Corresponding FP_LLOGB* macros are defined, whose values are required to have the obvious correspondence to those of the FP_ILOGB* macros. This patch implements these functions and macros for glibc. llogb uses the type-generic infrastructure, with an implementation similar to the wrapper for ilogb but with additional conversion from FP_ILOGB* to FP_LLOGB*; this approach avoids needing to modify or duplicate any of the architecture-specific ilogb implementations. Tests are also based on those for ilogb. Ideally the llogb functions would alias the ilogb ones when long is 32-bit, but such aliasing requires the associated header declarations of the different-type alias to be hidden, typically by defining macros before including the header (see e.g. how sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c defines lround to __hidden_lround before including <math.h>). The infrastructure for type-generic function implementations does not support defining such macros at present (since C code can't define a macro whose name is determined by other macros). So this patch leaves them as separate functions (similar to e.g. scalbln and scalbn being separate in such a case as well), but with the remapping of FP_ILOGB* to FP_LLOGB* conditioned out in the case where it would be the identity map. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New declaration. * math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New macro. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (__FP_LONG_MAX): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGB0): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGBNAN): Likewise. * math/Versions (llogb): New libm symbol at version GLIBC_2.25. (llogbf): Likewise. (llogbl): Likewise. * math/Makefile (gen-libm-calls): Add w_llogbF. (tests): Add test-fp-llogb-constants. * math/w_llogb_template.c: New file. Based on math/w_ilogb_template.c. * math/libm-test.inc (llogb_test_data): New array. (llogb_test): New function. (main): Call llogb_test. * math/test-fp-llogb-constants.c: New file. Based on math/test-fp-ilogb-constants.c. * math/test-tgmath-ret.c (llogb): New CHECK_RET_CONST call. (do_test): Call check_return_llogb. * math/test-tgmath.c (NCALLS): Increase to 126. (F(compile_test)): Call llogb. (F(llogb)): New function. * manual/math.texi (Exponents and Logarithms): Document llogb, llogbf, llogbl, FP_LLOGB0 and FP_LLOGBNAN. * manual/libm-err-tab.pl (@all_functions): Add llogb. * sysdeps/ieee754/ldbl-opt/nldbl-llogb.c: New file. * sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add llogb. (CFLAGS-nldbl-llogb.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise. |
||
---|---|---|
.. | ||
configure | ||
configure.ac | ||
Makefile | ||
math_ldbl_opt.c | ||
math_ldbl_opt.h | ||
math-type-macros-double.h | ||
math-type-macros-ldouble.h | ||
nldbl-acos.c | ||
nldbl-acosh.c | ||
nldbl-asin.c | ||
nldbl-asinh.c | ||
nldbl-asprintf_chk.c | ||
nldbl-asprintf.c | ||
nldbl-atan2.c | ||
nldbl-atan.c | ||
nldbl-atanh.c | ||
nldbl-cabs.c | ||
nldbl-cacos.c | ||
nldbl-cacosh.c | ||
nldbl-canonicalize.c | ||
nldbl-carg.c | ||
nldbl-casin.c | ||
nldbl-casinh.c | ||
nldbl-catan.c | ||
nldbl-catanh.c | ||
nldbl-cbrt.c | ||
nldbl-ccos.c | ||
nldbl-ccosh.c | ||
nldbl-ceil.c | ||
nldbl-cexp.c | ||
nldbl-cimag.c | ||
nldbl-clog10.c | ||
nldbl-clog.c | ||
nldbl-compat.c | ||
nldbl-compat.h | ||
nldbl-conj.c | ||
nldbl-copysign.c | ||
nldbl-cos.c | ||
nldbl-cosh.c | ||
nldbl-cpow.c | ||
nldbl-cproj.c | ||
nldbl-creal.c | ||
nldbl-csin.c | ||
nldbl-csinh.c | ||
nldbl-csqrt.c | ||
nldbl-ctan.c | ||
nldbl-ctanh.c | ||
nldbl-dprintf_chk.c | ||
nldbl-dprintf.c | ||
nldbl-erf.c | ||
nldbl-erfc.c | ||
nldbl-exp2.c | ||
nldbl-exp10.c | ||
nldbl-exp.c | ||
nldbl-expm1.c | ||
nldbl-fabs.c | ||
nldbl-fdim.c | ||
nldbl-finite.c | ||
nldbl-floor.c | ||
nldbl-fma.c | ||
nldbl-fmax.c | ||
nldbl-fmin.c | ||
nldbl-fmod.c | ||
nldbl-fprintf_chk.c | ||
nldbl-fprintf.c | ||
nldbl-frexp.c | ||
nldbl-fscanf.c | ||
nldbl-fwprintf_chk.c | ||
nldbl-fwprintf.c | ||
nldbl-fwscanf.c | ||
nldbl-gamma.c | ||
nldbl-getpayload.c | ||
nldbl-hypot.c | ||
nldbl-ilogb.c | ||
nldbl-iovfscanf.c | ||
nldbl-isinf.c | ||
nldbl-isnan.c | ||
nldbl-isoc99_fscanf.c | ||
nldbl-isoc99_fwscanf.c | ||
nldbl-isoc99_scanf.c | ||
nldbl-isoc99_sscanf.c | ||
nldbl-isoc99_swscanf.c | ||
nldbl-isoc99_vfscanf.c | ||
nldbl-isoc99_vfwscanf.c | ||
nldbl-isoc99_vscanf.c | ||
nldbl-isoc99_vsscanf.c | ||
nldbl-isoc99_vswscanf.c | ||
nldbl-isoc99_vwscanf.c | ||
nldbl-isoc99_wscanf.c | ||
nldbl-j0.c | ||
nldbl-j1.c | ||
nldbl-jn.c | ||
nldbl-ldexp.c | ||
nldbl-lgamma_r.c | ||
nldbl-lgamma.c | ||
nldbl-llogb.c | ||
nldbl-llrint.c | ||
nldbl-llround.c | ||
nldbl-log1p.c | ||
nldbl-log2.c | ||
nldbl-log10.c | ||
nldbl-log.c | ||
nldbl-logb.c | ||
nldbl-lrint.c | ||
nldbl-lround.c | ||
nldbl-modf.c | ||
nldbl-nan.c | ||
nldbl-nearbyint.c | ||
nldbl-nextafter.c | ||
nldbl-nextdown.c | ||
nldbl-nexttoward.c | ||
nldbl-nexttowardf.c | ||
nldbl-nextup.c | ||
nldbl-obstack_printf_chk.c | ||
nldbl-obstack_printf.c | ||
nldbl-obstack_vprintf_chk.c | ||
nldbl-obstack_vprintf.c | ||
nldbl-pow10.c | ||
nldbl-pow.c | ||
nldbl-printf_chk.c | ||
nldbl-printf_fp.c | ||
nldbl-printf_size.c | ||
nldbl-printf.c | ||
nldbl-qecvt_r.c | ||
nldbl-qecvt.c | ||
nldbl-qfcvt_r.c | ||
nldbl-qfcvt.c | ||
nldbl-qgcvt.c | ||
nldbl-remainder.c | ||
nldbl-remquo.c | ||
nldbl-rint.c | ||
nldbl-round.c | ||
nldbl-scalb.c | ||
nldbl-scalbln.c | ||
nldbl-scalbn.c | ||
nldbl-scanf.c | ||
nldbl-setpayload.c | ||
nldbl-setpayloadsig.c | ||
nldbl-signbit.c | ||
nldbl-significand.c | ||
nldbl-sin.c | ||
nldbl-sincos.c | ||
nldbl-sinh.c | ||
nldbl-snprintf_chk.c | ||
nldbl-snprintf.c | ||
nldbl-sprintf_chk.c | ||
nldbl-sprintf.c | ||
nldbl-sqrt.c | ||
nldbl-sscanf.c | ||
nldbl-strfmon_l.c | ||
nldbl-strfmon.c | ||
nldbl-strfroml.c | ||
nldbl-strtold_l.c | ||
nldbl-strtold.c | ||
nldbl-strtoldint.c | ||
nldbl-swprintf_chk.c | ||
nldbl-swprintf.c | ||
nldbl-swscanf.c | ||
nldbl-syslog_chk.c | ||
nldbl-syslog.c | ||
nldbl-tan.c | ||
nldbl-tanh.c | ||
nldbl-tgamma.c | ||
nldbl-totalorder.c | ||
nldbl-totalordermag.c | ||
nldbl-trunc.c | ||
nldbl-vasprintf_chk.c | ||
nldbl-vasprintf.c | ||
nldbl-vdprintf_chk.c | ||
nldbl-vdprintf.c | ||
nldbl-vfprintf_chk.c | ||
nldbl-vfprintf.c | ||
nldbl-vfscanf.c | ||
nldbl-vfwprintf_chk.c | ||
nldbl-vfwprintf.c | ||
nldbl-vfwscanf.c | ||
nldbl-vprintf_chk.c | ||
nldbl-vprintf.c | ||
nldbl-vscanf.c | ||
nldbl-vsnprintf_chk.c | ||
nldbl-vsnprintf.c | ||
nldbl-vsprintf_chk.c | ||
nldbl-vsprintf.c | ||
nldbl-vsscanf.c | ||
nldbl-vswprintf_chk.c | ||
nldbl-vswprintf.c | ||
nldbl-vswscanf.c | ||
nldbl-vsyslog_chk.c | ||
nldbl-vsyslog.c | ||
nldbl-vwprintf_chk.c | ||
nldbl-vwprintf.c | ||
nldbl-vwscanf.c | ||
nldbl-wcstold_l.c | ||
nldbl-wcstold.c | ||
nldbl-wcstoldint.c | ||
nldbl-wprintf_chk.c | ||
nldbl-wprintf.c | ||
nldbl-wscanf.c | ||
nldbl-y0.c | ||
nldbl-y1.c | ||
nldbl-yn.c | ||
s_asinh.c | ||
s_atan.c | ||
s_canonicalizel.c | ||
s_cbrt.c | ||
s_ceil.c | ||
s_clog10l.c | ||
s_copysign.c | ||
s_erf.c | ||
s_expm1.c | ||
s_fabs.c | ||
s_finite.c | ||
s_floor.c | ||
s_fma.c | ||
s_fmal.c | ||
s_frexp.c | ||
s_isinf.c | ||
s_isnan.c | ||
s_ldexp.c | ||
s_ldexpl.c | ||
s_llrint.c | ||
s_llround.c | ||
s_log1p.c | ||
s_logb.c | ||
s_lrint.c | ||
s_lround.c | ||
s_modf.c | ||
s_nearbyint.c | ||
s_nextafter.c | ||
s_nextdownl.c | ||
s_nexttowardfd.c | ||
s_remquo.c | ||
s_rint.c | ||
s_round.c | ||
s_scalbln.c | ||
s_scalbn.c | ||
s_significand.c | ||
s_significandl.c | ||
s_sin.c | ||
s_sincos.c | ||
s_tan.c | ||
s_tanh.c | ||
s_trunc.c | ||
Versions | ||
w_acos.c | ||
w_acosh.c | ||
w_acoshl.c | ||
w_acosl.c | ||
w_asin.c | ||
w_asinl.c | ||
w_atan2.c | ||
w_atan2l.c | ||
w_atanh.c | ||
w_atanhl.c | ||
w_cosh.c | ||
w_coshl.c | ||
w_exp10.c | ||
w_exp10l.c | ||
w_exp.c | ||
w_fmod.c | ||
w_fmodl.c | ||
w_hypot.c | ||
w_hypotl.c | ||
w_j0.c | ||
w_j0l.c | ||
w_j1.c | ||
w_j1l.c | ||
w_jn.c | ||
w_jnl.c | ||
w_lgamma_compat.c | ||
w_lgamma_compatl.c | ||
w_lgamma_r.c | ||
w_lgammal_r.c | ||
w_llogbl.c | ||
w_log2.c | ||
w_log2l.c | ||
w_log10.c | ||
w_log10l.c | ||
w_log.c | ||
w_logl.c | ||
w_pow.c | ||
w_powl.c | ||
w_remainder.c | ||
w_remainderl.c | ||
w_scalb.c | ||
w_scalbl.c | ||
w_sinh.c | ||
w_sinhl.c | ||
w_sqrt.c | ||
w_sqrtl.c | ||
w_tgamma.c | ||
w_tgammal.c |