This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix clog overflow/underflow (bug 13629)


On Mon, Mar 19, 2012 at 2:12 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Bug 13629 reports inaccuracy of clog near 1, and (in a comment on the
> same day) failures of an external testsuite for large input.
>
> There are two underlying issues here arising from the log(hypot) use:
> hypot cannot be accurate enough for clog in cases of overflow or
> underflow, and it cannot be accurate enough when the result is near 1
> for values near |z|=1. ?Exactly the same issues apply for clog10. ?I
> propose this patch to fix the overflow and underflow issues the same
> way I fixed them for csqrt, by scaling so that the result of hypot is
> normal (avoiding inaccuracy in the case of subnormal results) and
> finite (avoiding problems from infinite results) then adjusting the
> log value afterwards. ?This patch does *not* fix the issues with the
> real part of clog near |z|=1, which will be more involved to fix.
>
> Tested x86 and x86_64 and ulps updated accordingly. ?On x86_64 this
> depends on my atan2 patch
> <http://sourceware.org/ml/libc-alpha/2012-03/msg00703.html> to avoid
> spurious exceptions from some of the new tests causing them to fail.
>
> As I noticed while preparing testcases that GNU MPC does not implement
> mpc_log10, I sent a feature suggestion for that (and the other
> <complex.h> functions whose names, by analogy with the functions for
> real input, are reserved in C99 and C11 for future standardization,
> which glibc doesn't implement either) to mpc-discuss.
>
> 2012-03-19 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?[BZ #13629]
> ? ? ? ?* math/s_clog.c: Include <float.h>.
> ? ? ? ?(__clog): Scale large or subnormal inputs.
> ? ? ? ?* math/s_clogf.c: Likewise.
> ? ? ? ?* math/s_clogl.c: Likewise.
> ? ? ? ?* math/s_clog10.c: Include <float.h>.
> ? ? ? ?(M_LOG10_2): Define.
> ? ? ? ?(__clog10): Scale large or subnormal inputs.
> ? ? ? ?* math/s_clog10f.c: Likewise.
> ? ? ? ?* math/s_clog10l.c: Likewise.
> ? ? ? ?* math/libm-test.inc (clog_test): Add more tests.
> ? ? ? ?(clog10_test): Likewise.
> ? ? ? ?* sysdeps/i386/fpu/libm-test-ulps: Update.
> ? ? ? ?* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.


Is there no way to share the scaling code?

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]