summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/k_standard.c
AgeCommit message (Collapse)Author
2017-09-05Prefer new libm function wrappers for !LIBM_SVID_COMPAT.Joseph Myers
The initial obsoletion of SVID libm error handling left the old wrappers and __kernel_standard still being used for new ports and static linking, just with macro definitions of _LIB_VERSION and matherr that meant symbols with those names were never actually used and the code for different error handling variants could be optimized out. This patch cleans things up further by eliminating the __kernel_standard use for new ports and static linking. Now, the old wrappers no longer generate any code in the !LIBM_SVID_COMPAT case, while the new errno-only wrappers that were added for float128 support are now also used for float, double and long double in that case. The changes are generally straightforward. The w_scalb*_compat wrappers continue to be used (scalb is obsolescent in the sense of not being supported for float128, but is present in supported standards - the 2001 edition of POSIX and earlier XSI versions - so remains supported for static linking and new ports, as do the float and long double variants that are existing GNU extensions). Those wrappers would only call __kernel_standard in the _LIB_VERSION == _SVID_ case. Since we would like to be able to compile most of glibc without optimization, relying on a static function whose only use is under an if (0) condition being optimized away to avoid an undefined __kernel_standard reference may not be a good idea. Thus, the relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals added to guarantee it's not built at all in the case where __kernel_standard does not exist. Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added. ia64 gets dummy w_*.c to prevent those files being built where they would conflict with the ia64 libm, as with its existing w_*_compat.c. Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the math/ wrappers and in the long double wrappers in ldbl-opt (to avoid them setting up aliases and symbol versions for undefined symbols). I hope that future cleanups to how libm function aliases and symbol versioning are done will eliminate the need for most of the ldbl-opt wrappers. Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/generic/math-type-macros-double.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-float.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * sysdeps/generic/math-type-macros-ldouble.h: Include <math-svid-compat.h>. (__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT. * math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT condition. * math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * math/w_acosf_compat.c: Likewise. * math/w_acosh_compat.c: Likewise. * math/w_acoshf_compat.c: Likewise. * math/w_acoshl_compat.c: Likewise. * math/w_acosl_compat.c: Likewise. * math/w_asin_compat.c: Likewise. * math/w_asinf_compat.c: Likewise. * math/w_asinl_compat.c: Likewise. * math/w_atan2_compat.c: Likewise. * math/w_atan2f_compat.c: Likewise. * math/w_atan2l_compat.c: Likewise. * math/w_atanh_compat.c: Likewise. * math/w_atanhf_compat.c: Likewise. * math/w_atanhl_compat.c: Likewise. * math/w_cosh_compat.c: Likewise. * math/w_coshf_compat.c: Likewise. * math/w_coshl_compat.c: Likewise. * math/w_exp10_compat.c: Likewise. * math/w_exp10f_compat.c: Likewise. * math/w_exp10l_compat.c: Likewise. * math/w_exp2_compat.c: Likewise. * math/w_exp2f_compat.c: Likewise. * math/w_exp2l_compat.c: Likewise. * math/w_fmod_compat.c: Likewise. * math/w_fmodf_compat.c: Likewise. * math/w_fmodl_compat.c: Likewise. * math/w_hypot_compat.c: Likewise. * math/w_hypotf_compat.c: Likewise. * math/w_hypotl_compat.c: Likewise. * math/w_j0_compat.c: Likewise. * math/w_j0f_compat.c: Likewise. * math/w_j0l_compat.c: Likewise. * math/w_j1_compat.c: Likewise. * math/w_j1f_compat.c: Likewise. * math/w_j1l_compat.c: Likewise. * math/w_jn_compat.c: Likewise. * math/w_jnf_compat.c: Likewise. * math/w_jnl_compat.c: Likewise. * math/w_lgamma_r_compat.c: Likewise. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * math/w_log10_compat.c: Likewise. * math/w_log10f_compat.c: Likewise. * math/w_log10l_compat.c: Likewise. * math/w_log2_compat.c: Likewise. * math/w_log2f_compat.c: Likewise. * math/w_log2l_compat.c: Likewise. * math/w_log_compat.c: Likewise. * math/w_logf_compat.c: Likewise. * math/w_logl_compat.c: Likewise. * math/w_pow_compat.c: Likewise. * math/w_powf_compat.c: Likewise. * math/w_powl_compat.c: Likewise. * math/w_remainder_compat.c: Likewise. * math/w_remainderf_compat.c: Likewise. * math/w_remainderl_compat.c: Likewise. * math/w_sinh_compat.c: Likewise. * math/w_sinhf_compat.c: Likewise. * math/w_sinhl_compat.c: Likewise. * math/w_sqrt_compat.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * math/w_tgamma_compat.c: Likewise. * math/w_tgammaf_compat.c: Likewise. * math/w_tgammal_compat.c: Likewise. * math/w_scalb_compat.c (sysv_scalb): Condition definition on [LIBM_SVID_COMPAT]. (__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT]. * math/w_scalbf_compat.c (sysv_scalbf): Condition definition on [LIBM_SVID_COMPAT]. (__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT]. * math/w_scalbl_compat.c (sysv_scalbl): Condition definition on [LIBM_SVID_COMPAT]. (__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT]. * sysdeps/i386/fpu/w_sqrt.c: New file. * sysdeps/ia64/fpu/w_acos.c: Likewise. * sysdeps/ia64/fpu/w_acosf.c: Likewise. * sysdeps/ia64/fpu/w_acosh.c: Likewise. * sysdeps/ia64/fpu/w_acoshf.c: Likewise. * sysdeps/ia64/fpu/w_acoshl.c: Likewise. * sysdeps/ia64/fpu/w_acosl.c: Likewise. * sysdeps/ia64/fpu/w_asin.c: Likewise. * sysdeps/ia64/fpu/w_asinf.c: Likewise. * sysdeps/ia64/fpu/w_asinl.c: Likewise. * sysdeps/ia64/fpu/w_atan2.c: Likewise. * sysdeps/ia64/fpu/w_atan2f.c: Likewise. * sysdeps/ia64/fpu/w_atan2l.c: Likewise. * sysdeps/ia64/fpu/w_atanh.c: Likewise. * sysdeps/ia64/fpu/w_atanhf.c: Likewise. * sysdeps/ia64/fpu/w_atanhl.c: Likewise. * sysdeps/ia64/fpu/w_cosh.c: Likewise. * sysdeps/ia64/fpu/w_coshf.c: Likewise. * sysdeps/ia64/fpu/w_coshl.c: Likewise. * sysdeps/ia64/fpu/w_exp.c: Likewise. * sysdeps/ia64/fpu/w_exp10.c: Likewise. * sysdeps/ia64/fpu/w_exp10f.c: Likewise. * sysdeps/ia64/fpu/w_exp10l.c: Likewise. * sysdeps/ia64/fpu/w_exp2.c: Likewise. * sysdeps/ia64/fpu/w_exp2f.c: Likewise. * sysdeps/ia64/fpu/w_exp2l.c: Likewise. * sysdeps/ia64/fpu/w_expf.c: Likewise. * sysdeps/ia64/fpu/w_expl.c: Likewise. * sysdeps/ia64/fpu/w_fmod.c: Likewise. * sysdeps/ia64/fpu/w_fmodf.c: Likewise. * sysdeps/ia64/fpu/w_fmodl.c: Likewise. * sysdeps/ia64/fpu/w_hypot.c: Likewise. * sysdeps/ia64/fpu/w_hypotf.c: Likewise. * sysdeps/ia64/fpu/w_hypotl.c: Likewise. * sysdeps/ia64/fpu/w_lgamma_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_log.c: Likewise. * sysdeps/ia64/fpu/w_log10.c: Likewise. * sysdeps/ia64/fpu/w_log10f.c: Likewise. * sysdeps/ia64/fpu/w_log10l.c: Likewise. * sysdeps/ia64/fpu/w_log2.c: Likewise. * sysdeps/ia64/fpu/w_log2f.c: Likewise. * sysdeps/ia64/fpu/w_log2l.c: Likewise. * sysdeps/ia64/fpu/w_logf.c: Likewise. * sysdeps/ia64/fpu/w_logl.c: Likewise. * sysdeps/ia64/fpu/w_pow.c: Likewise. * sysdeps/ia64/fpu/w_powf.c: Likewise. * sysdeps/ia64/fpu/w_powl.c: Likewise. * sysdeps/ia64/fpu/w_remainder.c: Likewise. * sysdeps/ia64/fpu/w_remainderf.c: Likewise. * sysdeps/ia64/fpu/w_remainderl.c: Likewise. * sysdeps/ia64/fpu/w_sinh.c: Likewise. * sysdeps/ia64/fpu/w_sinhf.c: Likewise. * sysdeps/ia64/fpu/w_sinhl.c: Likewise. * sysdeps/ia64/fpu/w_sqrt.c: Likewise. * sysdeps/ia64/fpu/w_sqrtf.c: Likewise. * sysdeps/ia64/fpu/w_sqrtl.c: Likewise. * sysdeps/ia64/fpu/w_tgamma.c: Likewise. * sysdeps/ia64/fpu/w_tgammaf.c: Likewise. * sysdeps/ia64/fpu/w_tgammal.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/k_standard.c: Likewise. * sysdeps/ieee754/k_standardf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition long_double_symbol call on [LIBM_SVID_COMPAT]. * sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
2017-08-21Fix GCC 7 build of k_standard.c.Joseph Myers
This patch adds a default case to k_standard.c that calls __builtin_unreachable, to avoid an uninitialized variable error from GCC 7 (reported in <https://sourceware.org/ml/libc-alpha/2017-08/msg01012.html>). Tested for x86_64 (with GCC 7). * sysdeps/ieee754/k_standard.c (__kernel_standard): Add default case calling __builtin_unreachable.
2017-08-21Obsolete matherr, _LIB_VERSION, libieee.a.Joseph Myers
This patch obsoletes support for SVID libm error handling (the system where a user-defined function matherr is called on a libm function error; only enabled if you also set _LIB_VERSION = _SVID_ or _LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global variable to control libm error handling. matherr and _LIB_VERSION are made into compat symbols, not supported for new ports or for static linking. The libieee.a object file (which sets _LIB_VERSION = _IEEE_, so disabling errno setting for some functions) is also removed, and all the related definitions are removed from math.h. The manual already recommends against using matherr, and it's already not supported for _Float128 functions (those use new wrappers that don't support matherr, only errno) - this patch means that it becomes possible to e.g. add sinf32 as an alias to sinf without that resulting in undesired matherr support in sinf32 for existing glibc ports. matherr support is not part of any standard supported by glibc (it was removed in XPG4). Because matherr is a function to be defined by the user, of course user programs defining such a function will still continue to link; it just quietly won't be used. If they try to write to the library's copy of _LIB_VERSION to enable SVID error handling, however, they will get a link error (but if they define their own _LIB_VERSION variable, they won't). I expect the most likely case of build failures from this patch to be programs with unconditional cargo-culted uses of -lieee (based on a notion of "I want IEEE floating point", not any actual requirement for that library). Ideally, the new-port-or-static-linking case would use the new wrappers used for _Float128. This is not implemented in this patch, because of the complication of architecture-specific (powerpc32 and sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard directly. Thus, the old wrappers and __kernel_standard are still built unconditionally, and _LIB_VERSION still exists in static libm. But when the old wrappers and __kernel_standard are built in the non-compat case, _LIB_VERSION and matherr are defined as macros so code to support those features isn't actually built into static libm or new ports' shared libm after this patch. I intend to move to the new wrappers for static libm and new ports in followup patches. I believe the sqrt wrappers for powerpc32 and sparc can reasonably be removed. GCC already optimizes the normal case of sqrt by generating code that uses a hardware instruction and only calls the sqrt function if the argument was negative (if -fno-math-errno, of course, it just uses the hardware instruction without any check for negative argument being needed). Thus those wrappers will only actually get called in the case of negative arguments, which is not a case it makes sense to optimize for. But even without removing the powerpc32 and sparc wrappers it should still be possible to move to the new wrappers for static libm and new ports, just without having those dubious architecture-specific optimizations in static libm. Everything said about matherr equally applies to matherrf and matherrl (IA64-specific, undocumented), except that the structure of IA64 libm means it won't be converted to using the new wrappers (it doesn't use the old ones either, but its own error-handling code instead). As with other tests of compat symbols, I expect test-matherr and test-matherr-2 to need to become appropriately conditional once we have a system for disabling such tests for ports too new to have the relevant symbols. Tested for x86_64 and x86, and with build-many-glibcs.py. * math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove. [__USE_MISC] (_LIB_VERSION): Likewise. [__USE_MISC] (struct exception): Likewise. [__USE_MISC] (matherr): Likewise. [__USE_MISC] (DOMAIN): Likewise. [__USE_MISC] (SING): Likewise. [__USE_MISC] (OVERFLOW): Likewise. [__USE_MISC] (UNDERFLOW): Likewise. [__USE_MISC] (TLOSS): Likewise. [__USE_MISC] (PLOSS): Likewise. [__USE_MISC] (HUGE): Likewise. [__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC]. * math/math-svid-compat.h: New file. * conform/linknamespace.pl (@whitelist): Remove matherr, matherrf and matherrl. * include/math.h [!_ISOMAC] (__matherr): Remove. * manual/arith.texi (FP Exceptions): Do not document matherr. * math/Makefile (tests): Change test-matherr to test-matherr-3. (tests-internal): New variable. (install-lib): Do not add libieee.a. (non-lib.a): Likewise. (extra-objs): Do not add libieee.a and ieee-math.o. (CPPFLAGS-s_lib_version.c): Remove variable. ($(objpfx)libieee.a): Remove rule. ($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm). * math/ieee-math.c: Remove. * math/libm-test-support.c (matherr): Remove. * math/test-matherr.c: Use <support/test-driver.c>. Add copyright and license notices. Include <math-svid-compat.h> and <shlib-compat.h>. (matherr): Undefine as macro. Use compat_symbol_reference. (_LIB_VERSION): Likewise. * math/test-matherr-2.c: New file. * math/test-matherr-3.c: Likewise. * sysdeps/generic/math_private.h (__kernel_standard): Remove declaration. (__kernel_standard_f): Likewise. (__kernel_standard_l): Likewise. * sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or <math_private.h>. Include <math-svid-compat.h>. (_LIB_VERSION): Undefine as macro. (_LIB_VERSION_INTERNAL): Always initialize to _POSIX_. Define only if [LIBM_SVID_COMPAT || !defined SHARED]. If [LIBM_SVID_COMPAT], use compat_symbol. * sysdeps/ieee754/s_matherr.c: Do not include <math.h> or <math_private.h>. Include <math-svid-compat.h>. (matherr): Undefine as macro. (__matherr): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>. [_LIBC && LIBM_SVID_COMPAT] (matherrf): Use compat_symbol_reference. [_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise. [_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro. [_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise. * sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>. (MATHERR_D): Remove declaration. [!_LIBC] (_LIB_VERSION_TYPE): Likewise [!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise. [LIBM_BUILD] (pmatherrf): Likewise. [LIBM_BUILD] (pmatherr): Likewise. [LIBM_BUILD] (pmatherrl): Likewise. (DOMAIN): Likewise. (SING): Likewise. (OVERFLOW): Likewise. (UNDERFLOW): Likewise. (TLOSS): Likewise. (PLOSS): Likewise. * sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>. (__matherrf): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>. (__matherrl): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * math/lgamma-compat.h: Include <math-svid-compat.h>. * math/w_acos_compat.c: Likewise. * math/w_acosf_compat.c: Likewise. * math/w_acosh_compat.c: Likewise. * math/w_acoshf_compat.c: Likewise. * math/w_acoshl_compat.c: Likewise. * math/w_acosl_compat.c: Likewise. * math/w_asin_compat.c: Likewise. * math/w_asinf_compat.c: Likewise. * math/w_asinl_compat.c: Likewise. * math/w_atan2_compat.c: Likewise. * math/w_atan2f_compat.c: Likewise. * math/w_atan2l_compat.c: Likewise. * math/w_atanh_compat.c: Likewise. * math/w_atanhf_compat.c: Likewise. * math/w_atanhl_compat.c: Likewise. * math/w_cosh_compat.c: Likewise. * math/w_coshf_compat.c: Likewise. * math/w_coshl_compat.c: Likewise. * math/w_exp10_compat.c: Likewise. * math/w_exp10f_compat.c: Likewise. * math/w_exp10l_compat.c: Likewise. * math/w_exp2_compat.c: Likewise. * math/w_exp2f_compat.c: Likewise. * math/w_exp2l_compat.c: Likewise. * math/w_fmod_compat.c: Likewise. * math/w_fmodf_compat.c: Likewise. * math/w_fmodl_compat.c: Likewise. * math/w_hypot_compat.c: Likewise. * math/w_hypotf_compat.c: Likewise. * math/w_hypotl_compat.c: Likewise. * math/w_j0_compat.c: Likewise. * math/w_j0f_compat.c: Likewise. * math/w_j0l_compat.c: Likewise. * math/w_j1_compat.c: Likewise. * math/w_j1f_compat.c: Likewise. * math/w_j1l_compat.c: Likewise. * math/w_jn_compat.c: Likewise. * math/w_jnf_compat.c: Likewise. * math/w_jnl_compat.c: Likewise. * math/w_lgamma_main.c: Likewise. * math/w_lgamma_r_compat.c: Likewise. * math/w_lgammaf_main.c: Likewise. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_main.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * math/w_log10_compat.c: Likewise. * math/w_log10f_compat.c: Likewise. * math/w_log10l_compat.c: Likewise. * math/w_log2_compat.c: Likewise. * math/w_log2f_compat.c: Likewise. * math/w_log2l_compat.c: Likewise. * math/w_log_compat.c: Likewise. * math/w_logf_compat.c: Likewise. * math/w_logl_compat.c: Likewise. * math/w_pow_compat.c: Likewise. * math/w_powf_compat.c: Likewise. * math/w_powl_compat.c: Likewise. * math/w_remainder_compat.c: Likewise. * math/w_remainderf_compat.c: Likewise. * math/w_remainderl_compat.c: Likewise. * math/w_scalb_compat.c: Likewise. * math/w_scalbf_compat.c: Likewise. * math/w_scalbl_compat.c: Likewise. * math/w_sinh_compat.c: Likewise. * math/w_sinhf_compat.c: Likewise. * math/w_sinhl_compat.c: Likewise. * math/w_sqrt_compat.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * math/w_tgamma_compat.c: Likewise. * math/w_tgammaf_compat.c: Likewise. * math/w_tgammal_compat.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/k_standard.c: Likewise. * sysdeps/ieee754/k_standardf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
2016-12-02Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers.Joseph Myers
The dbl-64 implementation of __ieee754_pow returns a NaN for pow (qNaN, 0) when it should return 1. Normally this is covered up by the wrappers ending up calling __kernel_standard which fixes up the result for this case, but for -lieee the wrappers are bypassed and the bad result gets through as a return value. Now, the wrappers fixing this are dealing with variant error handling that wants a result of NaN for pow (qNaN, 0), and only ever call __kernel_standard for this case if NaN resulted from __ieee754_pow. This leads to a question of whether the dbl-64 code might be deliberately returning NaN in order to use those code paths. However, I can find no sign that this is deliberate. If it were deliberate one would expect other implementations to do the same, and would expect the return of NaN to be very old, but it appears it came in by accident when the present e_pow.c implementation replaced an fdlibm implementation in 2001. So it appears to be unintended that this path through the pow wrapper could be used at all. So this patch fixes the implementation to return 1 in this case as expected. This is consistent with all the other implementations. The relevant path through the wrappers is now unreachable, so is removed (which is the main motivation of this patch: to avoid that path becoming accidentally reachable when implementing TS 18661-1 semantics that pow (sNaN, 0) should return qNaN with "invalid" raised). Another path that would require __ieee754_pow (0, 0) to return 0 is also unreachable (as all implementations return 1, in accordance with C99 semantics), so is removed as well. Note: we don't have anything set up to test -lieee, which in any case is obsolescent (at some point we should remove the ability for new programs to access _LIB_VERSION or define matherr and have it called by glibc). So testing will be implicit through sNaN tests added when making sNaN inputs work correctly for pow functions. Tested for x86_64 and x86. [BZ #20919] * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Do not return NaN first argument when raised to power 0. * math/w_pow.c (__pow): Do not check for NaN or zero results from raising to power zero. * math/w_powf.c (__powf): Likewise. * math/w_powl.c (__powl): Likewise. * sysdeps/ieee754/k_standard.c (__kernel_standard): Do not handle pow (0, 0) or pow (NaN, 0).
2015-02-27Add comment to CSTR macro in k_standard.c.Joseph Myers
* sysdeps/ieee754/k_standard.c (CSTR): Add comment.
2015-02-26Avoid -Wno-write-strings for k_standard.c.Joseph Myers
We want to avoid -Wno- options in makefiles as far as possible, by cleaning up the underlying issues if possible or failing that by using diagnostic pragmas. This patch eliminates the use of -Wno-write-strings for sysdeps/ieee754/k_standard.c by using casts in the source file to cast away const; those casts are encapsulated in a macro that also deals with the choice of strings for float / double / long double functions (for which the logic was previously replicated many times). Tested for x86_64; the only change to disassembly of installed stripped shared libraries was a line number in an assertion. * sysdeps/ieee754/k_standard.c (CSTR): New macro. (__kernel_standard): Use CSTR macro when setting exc.name. * sysdeps/ieee754/Makefile [$(subdir) = math] (CFLAGS-k_standard.c): Remove variable.
2014-12-22Split __kernel_standard* functions (fixes bug 17724).Joseph Myers
Bug 17724 reports references to fesetround being brought in by ldbl-128ibm rintl via references to __rintl from __kernel_standard_l. Because all three __kernel_standard* functions are in the same file, this gets brought in even though only the long double version __kernel_standard_l needs __rintl, and the C90 functions use only __kernel_standard. This patch fixes this by splitting the three versions into separate files; it's fine for long double functions to refer to fe* functions directly, unless they get called by C90 double functions. Tested for x86_64 (testsuite; the reordering of code means disassembly of shared libraries can't usefully be compared). Tested for powerpc that the relevant issue disappears from the linknamespace test output. [BZ #17724] * sysdeps/ieee754/k_standard.c: Don't include <float.h>. (__kernel_standard_f): Remove. Moved to k_standardf.c. (__kernel_standard_l): Remove. Moved to k_standardl.c with (char *) casts added. * sysdeps/ieee754/k_standardf.c: New file. * sysdeps/ieee754/k_standardl.c: Likewise. * math/Makefile (libm-support): Remove k_standard. (libm-calls): Add k_standard.
2013-12-04Fix Bessel function error handling (bug 6807, bug 15901).Joseph Myers
2013-08-30Fix typos.Ondřej Bílka
2013-05-08Improve tgamma accuracy (bugs 2546, 2560, 5159, 15426).Joseph Myers
2012-07-30Fix lots of bitrot for stub configurations.Roland McGrath
2012-03-28Fix pow of negative numbers to integer exponents (bugs 369, 2678, 3866).Joseph Myers
2012-03-28Avoid overflows from long double functions using __kernel_standard.Joseph Myers
2012-03-09Use <> for math.h and math_private.h everywhere.Richard Henderson
Entire tree edited via find | grep | sed.
2012-01-27Remove __STDC__ conditionals from libm.Joseph Myers
2011-10-12Optimize libmUlrich Drepper
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.
2009-04-27* sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errors inUlrich Drepper
atanh should set ERANGE.
2009-04-26* sysdeps/ieee754/k_standard.c (__kernel_standard): Use correctUlrich Drepper
errno value vor pow(+-0,neg). * math/libm-test.inc (pow_test): Add tests for errno value for pole errors.
2009-04-25* sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errorsUlrich Drepper
for lgamma should se errno to ERANGE, not EDOM. * math/libm-test.inc (lgamma_test): Check errno for pole errors.
2004-11-21[BZ #552]Ulrich Drepper
Update. 2004-11-20 Jakub Jelinek <jakub@redhat.com> * sysdeps/ieee754/k_standard.c: Document code 50. (__kernel_standard) <case 50>: Avoid raising div-by-zero exception again. 2004-11-19 H.J. Lu <hongjiu.lu@intel.com> [BZ #552] * math/libm-test.inc (tgamma_test): Update tgamma (0) and tgamma (-0). * sysdeps/generic/w_tgamma.c (__tgamma): Properly handle |x| == 0. * sysdeps/generic/w_tgammaf.c (__tgammaf): Likewise. * sysdeps/generic/w_tgammal.c (__tgammal): Likewise. * sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Likewise. * sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise. * sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise. * sysdeps/ieee754/k_standard.c (__kernel_standard): Handle tgamma (0) and tgamma (-0).
2001-06-06Update.Ulrich Drepper
2001-06-04 Bruno Haible <haible@clisp.cons.org> * iconv/loop.c (UNICODE_TAG_HANDLER): New macro. * iconv/gconv_simple.c (__gconv_transform_internal_ascii): Invoke UNICODE_TAG_HANDLER. (__gconv_transform_internal_ucs2): Likewise. (__gconv_transform_internal_ucs2reverse): Likewise. * iconvdata/8bit-gap.c (BODY for TO_LOOP): Invoke UNICODE_TAG_HANDLER. * iconvdata/8bit-generic.c (BODY for TO_LOOP): Likewise. * iconvdata/ansi_x3.110.c (BODY for TO_LOOP): Likewise. * iconvdata/big5.c (BODY for TO_LOOP): Likewise. * iconvdata/big5hkscs.c (BODY for TO_LOOP): Likewise. * iconvdata/cp1255.c (BODY for TO_LOOP): Likewise. * iconvdata/cp1258.c (BODY for TO_LOOP): Likewise. * iconvdata/euc-cn.c (BODY for TO_LOOP): Likewise. * iconvdata/euc-jp.c (BODY for TO_LOOP): Likewise. * iconvdata/euc-kr.c (BODY for TO_LOOP): Likewise. * iconvdata/euc-tw.c (BODY for TO_LOOP): Likewise. * iconvdata/gbk.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm930.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm932.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm933.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm935.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm937.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm939.c (BODY for TO_LOOP): Likewise. * iconvdata/ibm943.c (BODY for TO_LOOP): Likewise. * iconvdata/iso646.c (BODY for TO_LOOP): Likewise. * iconvdata/iso8859-1.c (BODY for TO_LOOP): Likewise. * iconvdata/iso_6937.c (BODY for TO_LOOP): Likewise. * iconvdata/iso_6937-2.c (BODY for TO_LOOP): Likewise. * iconvdata/iso-2022-cn.c (BODY for TO_LOOP): Likewise. * iconvdata/iso-2022-cn-ext.c (BODY for TO_LOOP): Likewise. * iconvdata/iso-2022-kr.c (BODY for TO_LOOP): Likewise. * iconvdata/johab.c (BODY for TO_LOOP): Likewise. * iconvdata/sjis.c (BODY for TO_LOOP): Likewise. * iconvdata/t.61.c (BODY for TO_LOOP): Likewise. * iconvdata/uhc.c (BODY for TO_LOOP): Likewise. * iconvdata/unicode.c (BODY for TO_LOOP): Likewise. * iconvdata/iso-2022-jp.c (TAG_none, TAG_language, TAG_language_j, TAG_language_ja, TAG_language_k, TAG_language_ko, TAG_language_z, TAG_language_zh, CURRENT_TAG_MASK): New enum values. (EMIT_SHIFT_TO_INIT): Don't emit an escape sequence if ASCII_set is already selected but set2 or tag are set. (conversion): New enum type. (cvlist_t): New type. (CVLIST, CVLIST_FIRST, CVLIST_REST): New macros. (conversion_lists): New array. (BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja", prefer conversion to Japanese character sets. If "zh", prefer conversion to GB2312. If "ko", prefer conversion to KSC5601. Small optimizations. (INIT_PARAMS): Add tag. (UPDATE_PARAMS): Add tag. 2001-06-04 Bruno Haible <haible@clisp.cons.org> * locale/programs/locfile.c (write_locale_data): Before creat(), unlink the file, to avoid crashing the processes that mmap it. Change a double slash to a single slash. Free fname in case of error return. 2001-06-02 Jakub Jelinek <jakub@redhat.com> * sysdeps/i386/fpu/s_frexpl.S (__frexpl): Mostly revert 2000-12-03 changes, do the special handling for denormal numbers, not for normalized numbers (patch by <trevin@xmission.com>). * math/test-misc.c (main): Test frexpl with denormal arguments. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * math/libm-test.inc (llround_test): Add two new llround tests. * sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Don't allow overflow when rounding away from zero. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * math/Makefile (libm-calls): Add e_log2, w_log2, remove s_log2. * math/math_private.h (__ieee754_log2, __ieee754_log2f, __ieee754_log2l): New prototypes. * sysdeps/generic/w_log2.c: New file. * sysdeps/generic/w_log2f.c: New file. * sysdeps/generic/w_log2l.c: New file. * sysdeps/generic/s_log2l.c: Move... * sysdeps/generic/e_log2l.c: ...to here. Rename to __ieee754_log2l. * sysdeps/ieee754/k_standard.c (__kernel_standard): Handle log2(0) and log2(x < 0). * sysdeps/i386/fpu/s_log2.S: Move... * sysdeps/i386/fpu/e_log2.S: ...to here. Rename to __ieee754_log2. * sysdeps/i386/fpu/s_log2f.S: Move... * sysdeps/i386/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f. * sysdeps/i386/fpu/s_log2l.S: Move... * sysdeps/i386/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l. * sysdeps/m68k/fpu/s_log2.S: Move... * sysdeps/m68k/fpu/e_log2.S: ...to here. Rename to __ieee754_log2. * sysdeps/m68k/fpu/s_log2f.S: Move... * sysdeps/m68k/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f. * sysdeps/m68k/fpu/s_log2l.S: Move... * sysdeps/m68k/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l. * sysdeps/ieee754/dbl-64/s_log2.c: Move... * sysdeps/ieee754/dbl-64/e_log2.c: ...to here. Rename to __ieee754_log2. * sysdeps/ieee754/flt-32/s_log2f.c: Move... * sysdeps/ieee754/flt-32/e_log2f.c: ...to here. Rename to __ieee754_log2f. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * sysdeps/generic/w_exp2.c (u_threshold): Lower threshold so that even arguments which result in denormalized exp2 are accepted. (__exp2): Arguments equal to u_threshold already result into underflow. * sysdeps/generic/w_exp2f.c (u_threshold, __exp2f): Likewise. * sysdeps/generic/w_exp2l.c (u_threshold, __exp2l): Likewise. * sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Lomark was too low, with corrected lowmark use greaterequal, not greater. * sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * math/libm-test.inc (ilogb_test): Test that ilogb(+-Inf) == INT_MAX. * sysdeps/i386/fpu/s_ilogb.S (__ilogb): Return INT_MAX for +-Inf. * sysdeps/i386/fpu/s_ilogbf.S (__ilogbf): Likewise. * sysdeps/i386/fpu/s_ilogbl.S (__ilogbl): Likewise. * sysdeps/ieee754/dbl-64/s_ilogb.c (__ilogb): Likewise. * sysdeps/ieee754/flt-32/s_ilogbf.c (__ilogbf): Likewise. * sysdeps/ieee754/ldbl-128/s_ilogbl.c (__ilogbl): Likewise. * sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Likewise. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * sysdeps/generic/w_coshl.c (__coshl): Test if finite argument gave non-finite result instead of using constant in generic version. * sysdeps/generic/w_coshf.c (__coshf): Likewise. * sysdeps/generic/w_cosh.c (__cosh): Likewise. * sysdeps/generic/w_exp10.c (o_threshold, u_threshold): Remove. (__exp10): Test if finite argument gave non-finite result. * sysdeps/generic/w_exp10f.c (o_threshold, u_threshold, __exp10f): Likewise. * sysdeps/generic/w_exp10l.c (o_threshold, u_threshold, __exp10l): Likewise. 2001-06-04 Jakub Jelinek <jakub@redhat.com> * sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Fix overflow threshold constant (log(LDBL_MAX)+M_LN2l). 2001-05-29 Bruno Haible <haible@clisp.cons.org> * locale/programs/ld-ctype.c (idx_table): New struct type. (idx_table_init, idx_table_get, idx_table_add): New functions. (MAX_CHARNAMES_IDX): Remove macro. (locale_ctype_t): Change type of charnames_idx field. (ctype_startup): Change initialization of charnames_idx field. (find_idx): Use idx_table_get and idx_table_add for speed. * locale/programs/charmap.c (charmap_new_char): Fix ucs4 value computation of characters in a range. 2001-05-29 Bruno Haible <haible@clisp.cons.org> * iconvdata/gb18030.c (__fourbyte_to_ucs1): Add mappings for <U03F4>, <U03F5>. (__ucs_to_gb18030_tab1): Likewise. (BODY for FROM_LOOP): Add mapping for <U00010000>..<U0010FFFF>. (BODY for TO_LOOP): Likewise. * iconvdata/tst-table-charmap.sh: Update for charmaps containing <U00xxxxxx> syntax. * iconvdata/tst-table-from.c (bmp_only): New variable. (utf8_decode): If bmp_only, don't return characters outside Unicode plane 0. (main): When testing UTF-8 or GB18030, set bmp_only to 1. Don't print a conversion line if utf8_decode returns NULL. * iconvdata/tst-table-to.c (main): When testing encodings other than UTF-8 and GB18030, loop upto U+30000 instead of U+10000. Use UTF-8 instead of UCS-2 as input. * iconvdata/tst-table.sh: For GB18030, use only the part < 0x10000 of the charmap. 2001-05-29 Bruno Haible <haible@clisp.cons.org> * iconvdata/cns11643l1.c: Update to Unicode 3.1. (__cns11643l1_to_ucs4_tab): Regenerated. (__cns11643l1_from_ucs4_tab12): Regenerated. * iconvdata/cns11643.c: Update to Unicode 3.1. (__cns11643l14_to_ucs4_tab): Remove array. (__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab, __cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab, __cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New arrays. (__cns11643_from_ucs4p0_tab): Renamed from __cns11643_from_ucs4_tab. (__cns11643_from_ucs4p2_tab): New array. * iconvdata/cns11643.h (__cns11643l14_to_ucs4_tab): Remove declaration. (__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab, __cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab, __cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New declarations. (cns11643_to_ucs4): Treat planes 3, 4, 5, 6, 7, 15 instead of 14. (__cns11643_from_ucs4_tab): Remove declaration. (__cns11643_from_ucs4p0_tab, __cns11643_from_ucs4p2_tab): New declarations. (ucs4_to_cns11643): Update for new arrays. Treat U+3400..U+4DFF and U+20000..U+2A6D6. * iconvdata/cns11643l2.h (__cns11643_from_ucs4_tab): Remove declaration. (__cns11643_from_ucs4p0_tab): New declaration. (ucs4_to_cns11643l2): Update for new arrays. * iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Handle planes 3 to 7. (BODY for TO_LOOP): Handle planes 3 to 7, instead of plane 14. * iconvdata/EUC-TW.irreversible: New file. * iconvdata/tst-table.sh: Use it. * iconvdata/Makefile (distribute): Add CP1255.irreversible, CP1258.irreversible, EUC-TW.irreversible. 2001-05-29 Bruno Haible <haible@clisp.cons.org> * locale/C-translit.h.in: Add transliterations for new Unicode 3.1 mathematical symbols.
1999-07-14Update.Ulrich Drepper