summaryrefslogtreecommitdiff
path: root/math/s_ccosh_template.c
AgeCommit message (Collapse)Author
2018-05-10Move math_check_force_underflow macros to separate math-underflow.h.Joseph Myers
This patch continues cleaning up math_private.h by moving the math_check_force_underflow set of macros to a separate header math-underflow.h. This header is included by the files that need it rather than from math_private.h. Moving these macros to a separate file removes the math_private.h uses of macros from float.h, so the inclusion of float.h in math_private.h is also removed; files that were depending on that inclusion are fixed to include float.h directly. The inclusion of math-barriers.h from math_private.h will be removed in a separate patch. Tested for x86_64 and x86. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * math/math-underflow.h: New file. * sysdeps/generic/math_private.h: Do not include <float.h>. (fabs_tg): Remove macro. Moved to math-underflow.h. (min_of_type_f): Likewise. (min_of_type_): Likewise. (min_of_type_l): Likewise. (min_of_type_f128): Likewise. (min_of_type): Likewise. (math_check_force_underflow): Likewise. (math_check_force_underflow_nonneg): Likewise. (math_check_force_underflow_complex): Likewise. * math/e_exp2_template.c: Include <math-underflow.h>. * math/k_casinh_template.c: Likewise. * math/s_catan_template.c: Likewise. * math/s_catanh_template.c: Likewise. * math/s_ccosh_template.c: Likewise. * math/s_cexp_template.c: Likewise. * math/s_clog10_template.c: Likewise. * math/s_clog_template.c: Likewise. * math/s_csin_template.c: Likewise. * math/s_csinh_template.c: Likewise. * math/s_csqrt_template.c: Likewise. * math/s_ctan_template.c: Likewise. * math/s_ctanh_template.c: Likewise. * sysdeps/ieee754/dbl-64/e_asin.c: Likewise. * sysdeps/ieee754/dbl-64/e_atanh.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp2.c: Likewise. * sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise. * sysdeps/ieee754/dbl-64/e_hypot.c: Likewise. * sysdeps/ieee754/dbl-64/e_j1.c: Likewise. * sysdeps/ieee754/dbl-64/e_jn.c: Likewise. * sysdeps/ieee754/dbl-64/e_pow.c: Likewise. * sysdeps/ieee754/dbl-64/e_sinh.c: Likewise. * sysdeps/ieee754/dbl-64/s_asinh.c: Likewise. * sysdeps/ieee754/dbl-64/s_atan.c: Likewise. * sysdeps/ieee754/dbl-64/s_erf.c: Likewise. * sysdeps/ieee754/dbl-64/s_expm1.c: Likewise. * sysdeps/ieee754/dbl-64/s_log1p.c: Likewise. * sysdeps/ieee754/dbl-64/s_sin.c: Likewise. * sysdeps/ieee754/dbl-64/s_sincos.c: Likewise. * sysdeps/ieee754/dbl-64/s_tan.c: Likewise. * sysdeps/ieee754/dbl-64/s_tanh.c: Likewise. * sysdeps/ieee754/flt-32/e_asinf.c: Likewise. * sysdeps/ieee754/flt-32/e_atanhf.c: Likewise. * sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise. * sysdeps/ieee754/flt-32/e_j1f.c: Likewise. * sysdeps/ieee754/flt-32/e_jnf.c: Likewise. * sysdeps/ieee754/flt-32/e_sinhf.c: Likewise. * sysdeps/ieee754/flt-32/k_sinf.c: Likewise. * sysdeps/ieee754/flt-32/k_tanf.c: Likewise. * sysdeps/ieee754/flt-32/s_asinhf.c: Likewise. * sysdeps/ieee754/flt-32/s_atanf.c: Likewise. * sysdeps/ieee754/flt-32/s_erff.c: Likewise. * sysdeps/ieee754/flt-32/s_expm1f.c: Likewise. * sysdeps/ieee754/flt-32/s_log1pf.c: Likewise. * sysdeps/ieee754/flt-32/s_tanhf.c: Likewise. * sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_atanhl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_expl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128/e_hypotl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_sinhl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_sincosl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_sinl.c: Likewise. * sysdeps/ieee754/ldbl-128/k_tanl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_asinhl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_atanl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_erfl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_expm1l.c: Likewise. * sysdeps/ieee754/ldbl-128/s_log1pl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_tanhl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_powl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/k_sinl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_atanhl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise. * sysdeps/ieee754/ldbl-96/e_hypotl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_sinhl.c: Likewise. * sysdeps/ieee754/ldbl-96/k_sinl.c: Likewise. * sysdeps/ieee754/ldbl-96/k_tanl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_asinhl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_erfl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_tanhl.c: Likewise. * sysdeps/powerpc/fpu/e_hypot.c: Likewise. * sysdeps/x86/fpu/powl_helper.c: Likewise. * sysdeps/ieee754/dbl-64/s_nextup.c: Include <float.h>. * sysdeps/ieee754/flt-32/s_nextupf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nextupl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nextupl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_nextupl.c: Likewise.
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-09-13Define and use libm_alias_double.Joseph Myers
Continuing the process of setting up common macros for libm function aliases, with a view to using them to define _FloatN / _FloatNx aliases in future, this patch adds a libm_alias_double macro and uses it in the type-generic templates. This macro handles defining aliases for double, and for long double in the NO_LONG_DOUBLE case. It also handles defining compat symbols for long double = double for architectures that changed their long double format. By so doing, it eliminates the need for the M_LIBM_NEED_COMPAT and declare_mgen_libm_compat macros; the single declare_mgen_alias call in each template now suffices to define all required compat symbols. When used for more double functions (not based on type-generic templates), I expect it will eliminate the need for most ldbl-opt wrappers for such functions. A few special cases are needed. __clog10l is a public symbol (for historical reasons) so needs to be given appropriate compat versions for architectures that changed their long double format, but is not defined as an alias using the normal macros since __clog10* are *not* public symbols for _FloatN / _FloatNx types. For scalbn, scalbln and log1p, the changes adding errno setting support for those functions left compat symbols pointing directly to the non-errno-setting implementations. There is no requirement for the compat symbols not to set errno; that just made for the simplest patches at that time. Now, with these common macros, it's natural to redirect the compat symbols to the errno-setting wrappers, which I intend to do in a separate patch. Tested for x86_64, and with build-many-glibcs.py. For ldbl-opt platforms the stripped libm.so binaries are changed (disassembly unchanged) because the details of how the clog10l compat symbol is created mean it ceases to be weak as it was before; for other platforms, stripped libm.so binaries are unchanged. 2017-09-13 Joseph Myers <joseph@codesourcery.com> * sysdeps/generic/libm-alias-double.h: New file. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h: Likewise. * sysdeps/generic/math-type-macros-double.h: Include <libm-alias-double.h>. [declare_mgen_alias] (declare_mgen_alias): Define to use libm_alias_double. * sysdeps/generic/math-type-macros.h [!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Remove macro. [!M_LIBM_NEED_COMPAT] (declare_mgen_libm_compat): Likewise. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Remove. * math/cabs_template.c [M_LIBM_NEED_COMPAT]: Remove conditional code. * math/carg_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/cimag_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/conj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/creal_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cacosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_casinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_catanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccos_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ccosh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cexp_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog10_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_clog_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cpow_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_cproj_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csinh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_csqrt_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_ctanh_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fdim_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmax_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_fmin_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/s_nan_template.c [M_LIBM_NEED_COMPAT]: Likewise. * math/w_ilogb_template.c [M_LIBM_NEED_COMPAT]: Likewise. * sysdeps/ieee754/ldbl-opt/s_clog10.c: New file. * sysdeps/ieee754/ldbl-opt/s_ldexp.c (M_LIBM_NEED_COMPAT): Remove macro. (declare_mgen_alias): New macro. * sysdeps/ieee754/ldbl-opt/w_log1p.c: New file. * sysdeps/ieee754/ldbl-opt/w_scalbln.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c (M_LIBM_NEED_COMPAT): Remove macro. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c [HAVE_AS_VIS3_SUPPORT]: Include <math_ldbl_opt.h> and <first-versions.h>. [HAVE_AS_VIS3_SUPPORT && LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_fdiml)]: Define fdiml as compat symbol.
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-10-14Clean up some complex functions raising FE_INVALID.Joseph Myers
Some of the complex arithmetic functions have the following pattern: in some piece of code, one part of the input (real or imaginary, depending on the function) is either infinite or NaN. Part of the result is to be set to NaN in either case, and FE_INVALID raised only if the relevant part of the input was infinite. In such a case, there is no actual need for the conditional on the type of the input, since subtracting the relevant part of the input from itself will produce a NaN, with FE_INVALID only if the relevant part of the input was infinite. This simplifies the code, and as a quality-of-implementation matter also improves things by propagating NaN payloads. (Right now these functions always raise FE_INVALID for signaling NaN arguments because of the call to fpclassify - at least unless glibc is built with -Os - but if fpclassify moves to using integer arithmetic in future, doing arithmetic on the NaN argument also ensures an exception for sNaNs.) Tested for x86_64 and x86. * math/s_ccosh_template.c (M_DECL_FUNC (__ccosh)): Instead of raising FE_INVALID with feraisexcept in case where part of argument is infinite, subtract that part of argument from itself. * math/s_cexp_template.c (M_DECL_FUNC (__cexp)): Likewise. * math/s_csin_template.c (M_DECL_FUNC (__csin)): Likewise. * math/s_csinh_template.c (M_DECL_FUNC (__csinh)): Likewise.
2016-10-11Avoid M_NAN + M_NAN in complex functions.Joseph Myers
Some libm complex functions have code that computes M_NAN + M_NAN. This is nonsensical; it's just equivalent to M_NAN, since it's a quiet NaN (and the comments suggesting this raises an exception are similarly wrong). This patch changes the code just to use M_NAN (and removes the bogus comments). (Preferably, code should either propagate an input NaN or do a computation that raises "invalid" and generates a default NaN at the same time. There are various cases, however, that currently raise "invalid" even for NaN inputs; I think those are cases where "invalid" is optional in ISO C so a change to whether it's raised would be OK, but they would still need more careful consideration than the cases where such issues do not arise.) Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * math/s_ccosh_template.c (M_DECL_FUNC (__ccosh)): Use M_NAN instead of M_NAN + M_NAN. * math/s_csinh_template.c (M_DECL_FUNC (__csinh)): Likewise.
2016-08-19Convert _Complex cosine functions to generated codePaul E. Murphy
This is fairly straight fowards. m68k overrides are updated to use the framework, and thus are simplified a bit.
2016-08-19Prepare to convert _Complex cosine functionsPaul E. Murphy
This patch has no function changes, except to ensure the git history correctly tracks the changes to convert the double version of these functions into a templated version.