| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
There is quiet truncation to double arithmetic in several
files. I noticed them when building ldbl-128 in a
soft-fp context. This did not change any test results.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various floating-point functions have code to force underflow
exceptions if a tiny result was computed in a way that might not have
resulted in such exceptions even though the result is inexact. This
typically uses math_force_eval to ensure that the underflowing
expression is evaluated, but sometimes uses volatile.
This patch refactors such code to use three new macros
math_check_force_underflow, math_check_force_underflow_nonneg and
math_check_force_underflow_complex (which in turn use
math_force_eval). In the limited number of cases not suited to a
simple conversion to these macros, existing uses of volatile are
changed to use math_force_eval instead. The converted code does not
always execute exactly the same sequence of operations as the original
code, but the overall effects should be the same.
Tested for x86_64, x86, mips64 and powerpc.
* sysdeps/generic/math_private.h (fabs_tg): New macro.
(min_of_type): Likewise.
(math_check_force_underflow): Likewise.
(math_check_force_underflow_nonneg): Likewise.
(math_check_force_underflow_complex): Likewise.
* math/e_exp2l.c (__ieee754_exp2l): Use
math_check_force_underflow_nonneg.
* math/k_casinh.c (__kernel_casinh): Likewise.
* math/k_casinhf.c (__kernel_casinhf): Likewise.
* math/k_casinhl.c (__kernel_casinhl): Likewise.
* math/s_catan.c (__catan): Use
math_check_force_underflow_complex.
* math/s_catanf.c (__catanf): Likewise.
* math/s_catanh.c (__catanh): Likewise.
* math/s_catanhf.c (__catanhf): Likewise.
* math/s_catanhl.c (__catanhl): Likewise.
* math/s_catanl.c (__catanl): Likewise.
* math/s_ccosh.c (__ccosh): Likewise.
* math/s_ccoshf.c (__ccoshf): Likewise.
* math/s_ccoshl.c (__ccoshl): Likewise.
* math/s_cexp.c (__cexp): Likewise.
* math/s_cexpf.c (__cexpf): Likewise.
* math/s_cexpl.c (__cexpl): Likewise.
* math/s_clog.c (__clog): Use math_check_force_underflow_nonneg.
* math/s_clog10.c (__clog10): Likewise.
* math/s_clog10f.c (__clog10f): Likewise.
* math/s_clog10l.c (__clog10l): Likewise.
* math/s_clogf.c (__clogf): Likewise.
* math/s_clogl.c (__clogl): Likewise.
* math/s_csin.c (__csin): Use math_check_force_underflow_complex.
* math/s_csinf.c (__csinf): Likewise.
* math/s_csinh.c (__csinh): Likewise.
* math/s_csinhf.c (__csinhf): Likewise.
* math/s_csinhl.c (__csinhl): Likewise.
* math/s_csinl.c (__csinl): Likewise.
* math/s_csqrt.c (__csqrt): Use math_check_force_underflow.
* math/s_csqrtf.c (__csqrtf): Likewise.
* math/s_csqrtl.c (__csqrtl): Likewise.
* math/s_ctan.c (__ctan): Use math_check_force_underflow_complex.
* math/s_ctanf.c (__ctanf): Likewise.
* math/s_ctanh.c (__ctanh): Likewise.
* math/s_ctanhf.c (__ctanhf): Likewise.
* math/s_ctanhl.c (__ctanhl): Likewise.
* math/s_ctanl.c (__ctanl): Likewise.
* stdlib/strtod_l.c (round_and_return): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/dbl-64/e_asin.c (__ieee754_asin): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/e_atanh.c (__ieee754_atanh): Likewise.
* sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Do not use
volatile when forcing underflow.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r):
Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
* sysdeps/ieee754/dbl-64/s_asinh.c (__asinh): Likewise.
* sysdeps/ieee754/dbl-64/s_atan.c (atan): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/s_erf.c (__erf): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/s_expm1.c (__expm1): Likewise.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/dbl-64/s_log1p.c (__log1p): Use
math_check_force_underflow.
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Likewise.
* sysdeps/ieee754/dbl-64/s_tan.c (tan): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/dbl-64/s_tanh.c (__tanh): Use
math_check_force_underflow.
* sysdeps/ieee754/flt-32/e_asinf.c (__ieee754_asinf): Likewise.
* sysdeps/ieee754/flt-32/e_atanhf.c (__ieee754_atanhf): Likewise.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_j1f): Use
math_check_force_underflow.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/flt-32/e_sinhf.c (__ieee754_sinhf): Likewise.
* sysdeps/ieee754/flt-32/k_sinf.c (__kernel_sinf): Likewise.
* sysdeps/ieee754/flt-32/k_tanf.c (__kernel_tanf): Likewise.
* sysdeps/ieee754/flt-32/s_asinhf.c (__asinhf): Likewise.
* sysdeps/ieee754/flt-32/s_atanf.c (__atanf): Likewise.
* sysdeps/ieee754/flt-32/s_erff.c (__erff): Likewise.
* sysdeps/ieee754/flt-32/s_expm1f.c (__expm1f): Likewise.
* sysdeps/ieee754/flt-32/s_log1pf.c (__log1pf): Likewise.
* sysdeps/ieee754/flt-32/s_tanhf.c (__tanhf): Likewise.
* sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-128/e_atanhl.c (__ieee754_atanhl):
Likewise.
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128/e_sinhl.c (__ieee754_sinhl): Likewise.
* sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-128/k_tanl.c (__kernel_tanl): Likewise.
* sysdeps/ieee754/ldbl-128/s_asinhl.c (__asinhl): Likewise.
* sysdeps/ieee754/ldbl-128/s_atanl.c (__atanl): Likewise.
* sysdeps/ieee754/ldbl-128/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Likewise.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128/s_tanhl.c (__tanhl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
Use math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise.
* sysdeps/ieee754/ldbl-96/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Likewise.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_sinhl.c (__ieee754_sinhl): Likewise.
* sysdeps/ieee754/ldbl-96/k_sinl.c (__kernel_sinl): Likewise.
* sysdeps/ieee754/ldbl-96/k_tanl.c (__kernel_tanl): Use
math_check_force_underflow_nonneg.
* sysdeps/ieee754/ldbl-96/s_asinhl.c (__asinhl): Use
math_check_force_underflow.
* sysdeps/ieee754/ldbl-96/s_erfl.c (__erfl): Likewise.
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Use math_force_eval
instead of volatile.
* sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Use
math_check_force_underflow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes bug 15319, missing underflows from atan / atan2 when
the result of atan is very close to its small argument (or that of
atan2 is very close to the ratio of its arguments, which may be an
exact division).
The usual approach of doing an underflowing computation if the
computed result is subnormal is followed. For 32-bit x86, there are
extra complications: the inline __ieee754_atan2 in bits/mathinline.h
needs to be disabled for float and double because other libm functions
using it generally rely on getting proper underflow exceptions from
it, while the out-of-line functions have to remove excess range and
precision from the underflowing result so as to return an exact 0 in
the case where errno should be set for underflow to 0. (The failures
I saw without that are similar to those Carlos reported for other
functions, where I haven't seen a response to
<https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>
confirming if my diagnosis is correct. Arguably all libm functions
with float and double returns should remove excess range and
precision, but that's a separate matter.)
The x86_64 long double case reported in a comment in bug 15319 is not
a bug (it's an argument of LDBL_MIN, and x86_64 is an after-rounding
architecture so the correct IEEE result is not to raise underflow in
the given rounding mode, in addition to treating the result as an
exact LDBL_MIN being within the newly clarified documentation of
accuracy goals). I'm presuming that the fpatan instruction can be
trusted to raise appropriate exceptions when the (long double) result
underflows (after rounding) and so no changes are needed for x86 /
x86_64 long double functions here; empirically this is the case for
the cases covered in the testsuite, on my system.
Tested for x86_64, x86, powerpc and mips64. Only 32-bit x86 needs
ulps updates (for the changes to inlines meaning some functions no
longer get excess precision from their __ieee754_atan2* calls).
[BZ #15319]
* sysdeps/i386/fpu/e_atan2.S (dbl_min): New object.
(MO): New macro.
(__ieee754_atan2): For results with small absolute value, force
underflow exception and remove excess range and precision from
return value.
* sysdeps/i386/fpu/e_atan2f.S (flt_min): New object.
(MO): New macro.
(__ieee754_atan2f): For results with small absolute value, force
underflow exception and remove excess range and precision from
return value.
* sysdeps/i386/fpu/s_atan.S (dbl_min): New object.
(MO): New macro.
(__atan): For results with small absolute value, force underflow
exception and remove excess range and precision from return value.
* sysdeps/i386/fpu/s_atanf.S (flt_min): New object.
(MO): New macro.
(__atanf): For results with small absolute value, force underflow
exception and remove excess range and precision from return value.
* sysdeps/ieee754/dbl-64/e_atan2.c: Include <float.h> and
<math.h>.
(__ieee754_atan2): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/dbl-64/s_atan.c: Include <float.h> and
<math_private.h>.
(atan): Force underflow exception for results with small absolute
value.
* sysdeps/ieee754/flt-32/s_atanf.c: Include <float.h>.
(__atanf): Force underflow exception for results with small
absolute value.
* sysdeps/ieee754/ldbl-128/s_atanl.c: Include <float.h> and
<math.h>.
(__atanl): Force underflow exception for results with small
absolute value.
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <float.h>.
(__atanl): Force underflow exception for results with small
absolute value.
* sysdeps/x86/fpu/bits/mathinline.h
[!__SSE2_MATH__ && !__x86_64__ && __LIBC_INTERNAL_MATH_INLINES]
(__ieee754_atan2): Only define inline for long double.
* sysdeps/x86_64/fpu/multiarch/e_atan2.c
[HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Include <math.h>.
* math/auto-libm-test-in: Do not mark underflow exceptions as
possibly missing for bug 15319. Add more tests of atan2.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (casin_test_data): Do not mark underflow
exceptions as possibly missing for bug 15319.
(casinh_test_data): Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Update.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
With help from Joseph Myers.
* sysdeps/ieee754/ldbl-128/s_atanl.c (__atanl): Handle tiny and
very large arguments properly.
* math/libm-test.inc (atan_test): New tests.
(atan2_test): New tests.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
|
|
|
|
| |
Entire tree edited via find | grep | sed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* crypt/crypt.c: Changed copying permission notice to Lesser GPL
from Library GPL.
* crypt/crypt_util.c: Likewise.
* crypt/ufc.c: Likewise.
* elf/dl-conflict.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* iconv/iconvconfig.h: Likewise.
* linuxthreads/Examples/ex10.c: Likewise.
* linuxthreads/Examples/ex11.c: Likewise.
* linuxthreads/Examples/ex13.c: Likewise.
* linuxthreads/Examples/ex8.c: Likewise.
* linuxthreads/Examples/ex9.c: Likewise.
* linuxthreads/barrier.c: Likewise.
* linuxthreads/events.c: Likewise.
* linuxthreads/lockfile.c: Likewise.
* linuxthreads/no-tsd.c: Likewise.
* linuxthreads/pt-machine.c: Likewise.
* linuxthreads/ptclock_gettime.c: Likewise.
* linuxthreads/ptclock_settime.c: Likewise.
* linuxthreads/rwlock.c: Likewise.
* linuxthreads/sysdeps/alpha/pspinlock.c: Likewise.
* linuxthreads/sysdeps/alpha/pt-machine.h: Likewise.
* linuxthreads/sysdeps/arm/pspinlock.c: Likewise.
* linuxthreads/sysdeps/arm/pt-machine.h: Likewise.
* linuxthreads/sysdeps/cris/pspinlock.c: Likewise.
* linuxthreads/sysdeps/cris/pt-machine.h: Likewise.
* linuxthreads/sysdeps/hppa/pspinlock.c: Likewise.
* linuxthreads/sysdeps/hppa/pt-machine.h: Likewise.
* linuxthreads/sysdeps/i386/i686/pt-machine.h: Likewise.
* linuxthreads/sysdeps/i386/pspinlock.c: Likewise.
* linuxthreads/sysdeps/i386/pt-machine.h: Likewise.
* linuxthreads/sysdeps/i386/useldt.h: Likewise.
* linuxthreads/sysdeps/ia64/pspinlock.c: Likewise.
* linuxthreads/sysdeps/ia64/pt-machine.h: Likewise.
* linuxthreads/sysdeps/m68k/pspinlock.c: Likewise.
* linuxthreads/sysdeps/m68k/pt-machine.h: Likewise.
* linuxthreads/sysdeps/mips/pspinlock.c: Likewise.
* linuxthreads/sysdeps/mips/pt-machine.h: Likewise.
* linuxthreads/sysdeps/powerpc/pspinlock.c: Likewise.
* linuxthreads/sysdeps/powerpc/pt-machine.h: Likewise.
* linuxthreads/sysdeps/pthread/bits/initspin.h: Likewise.
* linuxthreads/sysdeps/pthread/bits/libc-lock.h: Likewise.
* linuxthreads/sysdeps/pthread/bits/libc-tsd.h: Likewise.
* linuxthreads/sysdeps/pthread/getcpuclockid.c: Likewise.
* linuxthreads/sysdeps/pthread/posix-timer.h: Likewise.
* linuxthreads/sysdeps/pthread/timer_create.c: Likewise.
* linuxthreads/sysdeps/pthread/timer_delete.c: Likewise.
* linuxthreads/sysdeps/pthread/timer_getoverr.c: Likewise.
* linuxthreads/sysdeps/pthread/timer_gettime.c: Likewise.
* linuxthreads/sysdeps/pthread/timer_routines.c: Likewise.
* linuxthreads/sysdeps/pthread/timer_settime.c: Likewise.
* linuxthreads/sysdeps/pthread/tst-timer.c: Likewise.
* linuxthreads/sysdeps/s390/pspinlock.c: Likewise.
* linuxthreads/sysdeps/s390/s390-32/pt-machine.h: Likewise.
* linuxthreads/sysdeps/s390/s390-64/pt-machine.h: Likewise.
* linuxthreads/sysdeps/sh/pspinlock.c: Likewise.
* linuxthreads/sysdeps/sh/pt-machine.h: Likewise.
* linuxthreads/sysdeps/sparc/sparc32/pspinlock.c: Likewise.
* linuxthreads/sysdeps/sparc/sparc32/pt-machine.h: Likewise.
* linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c: Likewise.
* linuxthreads/sysdeps/sparc/sparc64/pspinlock.c: Likewise.
* linuxthreads/sysdeps/sparc/sparc64/pt-machine.h: Likewise.
* linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h: Likewise.
* linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h: Likewise.
* linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h: Likewise.
* linuxthreads/sysdeps/unix/sysv/linux/hppa/bits/initspin.h: Likewise.
* linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise.
* linuxthreads/tststack.c: Likewise.
* linuxthreads/unload.c: Likewise.
* linuxthreads/weaks.c: Likewise.
* linuxthreads/wrapsyscall.c: Likewise.
* malloc/arena.c: Likewise.
* malloc/hooks.c: Likewise.
* malloc/malloc.c: Likewise.
* posix/glob/Makefile.ami: Likewise.
* posix/glob/Makefile.in: Likewise.
* stdlib/gmp-impl.h: Likewise.
* stdlib/gmp.h: Likewise.
* sysdeps/generic/dl-iteratephdr-static.c: Likewise.
* sysdeps/generic/strnlen.c: Likewise.
* sysdeps/mach/hurd/powerpc/bits/sigcontext.h: Likewise.
* sysdeps/mach/hurd/recvmsg.c: Likewise.
* sysdeps/mach/hurd/sendmsg.c: Likewise.
* sysdeps/mach/hurd/spawni.c: Likewise.
* sysdeps/mach/powerpc/machine-sp.h: Likewise.
* sysdeps/mach/powerpc/sysdep.h: Likewise.
* sysdeps/mach/powerpc/thread_state.h: Likewise.
* sysdeps/unix/bsd/bsd4.4/bits/socket.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/dl-iteratephdr-static.c: Likewise.
* sysdeps/x86_64/gmp-mparam.h: Likewise.
|
|
2001-04-13 Ulrich Drepper <drepper@redhat.com>
* sysdeps/ieee754/ldbl-128/s_atanl.c: New file.
Contributed by Stephen L Moshier <moshier@mediaone.net>.
|