This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix signs of zeros from casinh, cacosh etc. (bug 10716)
On Tuesday, March 06, 2012 03:57:23 Joseph S. Myers wrote:
> Bug 10716, "various problems in cacosh and cacos", reports issues with
> casinh, casin, cacosh and cacos that involve wrong signs of zeros in
> results or wrong behavior around branch cuts.
>
> The bug is a bit confusing and some issues listed there have been
> fixed. This patch adds testcases for those functions on both real and
> imaginary axes, with the zero coordinate both positive and negative,
> and fixes the problems that still appear to be present.
>
> For casinh, this is mainly about signs of zeros but it's also possible
> some underflow cases might result in a bad sign for a nonzero value
> near the branch cuts; I didn't find such a case or conclude it was
> impossible, and put in copysign calls that would cover it anyway
> rather than limiting the explicit sign setting to zeros.
>
> For cacosh, the problem is that values close to the interval [-1, 1]
> result in logs of values close to |z|=1 and it's possible that
> rounding error will result in a negative real part (which should never
> occur for the result of cacosh). This is fixed by replacing negative
> real parts by 0 in the case that will apply when close to that
> interval. (Certainly there is room for further improvement of the
> code to end up using log1p and avoid errors from logs of values close
> to |z|=1, just as casinh could be similarly improved as discussed in
> bug 10357.)
>
> Tested on x86_64 and x86 and ULPs updated accordingly.
>
> 2012-03-06 Joseph Myers <joseph@codesourcery.com>
>
> [BZ #10716]
> * math/s_cacosh.c (__cacosh): Convert negative log results to 0.
> * math/s_cacoshf.c (__cacoshf): Likewise.
> * math/s_cacoshl.c (__cacoshl): Likewise.
> * math/s_casinh.c (__casinh): Set signs of result from argument.
> * math/s_casinhf.c (__casinhf): Likewise.
> * math/s_casinhl.c (__casinhl): Likewise.
> * math/libm-test.inc (cacos_test, cacosh_test, casin_test)
> (casinh_test): Add more tests.
> * sysdeps/i386/fpu/libm-test-ulps: Update.
> * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
This is fine. Thanks for adding all the tests as well!
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126