sinl/cosl for ldbl-96
Andreas Jaeger
aj@suse.com
Fri Mar 16 09:56:00 GMT 2012
On 03/16/2012 01:52 AM, Joseph S. Myers wrote:
> This patch fixes the problems with range reduction for sinl / cosl /
> sincosl (ldbl-96, bug 13851) by providing a C implementation and using
> it instead of the x87 instructions.
>
> In general the C implementation is based on Jakub's ldbl-128
> implementation, and I did not try to optimize the polynomials used for
> the lower precision of ldbl-96 (it's probably possible to use fewer
> terms without any significant effect on accuracy); I used plain
> floating point in ldbl-96 in place of various bit-manipulations of the
> floating-point representation done in ldbl-128. I did regenerate the
> table of precomputed values (t_sincosl.c) with the attached program
> (having verified that a variant of it for 113-bit precision appeared
> to replicate the values in ldbl-128/t_sincosl.c).
>
> It turned out that the general range reduction code, not previously
> used for x86, needed a __FLT_EVAL_METHOD__ != 0 fix in the case prec
> == 2 (the value to be used for 64-bit mantissa) similar to that
> already present for prec == 3 (113-bit mantissa).
>
> In the course of preparing this I found what appears to be a bug in
> the ldbl-128 and ldbl-128ibm implementations of k_sinl.c, for which
> I'll send a patch separately.
>
> Tested x86 and x86_64 and ULPs updated based on that testing.
> 2012-03-16 Joseph Myers<joseph@codesourcery.com>
>
> [BZ #13851]
> * sysdeps/ieee754/ldbl-96/e_rem_pio2l.c: New file.
> * sysdeps/ieee754/ldbl-96/k_cosl.c: Likewise.
> * sysdeps/ieee754/ldbl-96/k_sinl.c: Likewise.
> * sysdeps/ieee754/ldbl-96/t_sincosl.c: Likewise.
> * sysdeps/ieee754/ldbl-96/s_cosl.c (__cosl): Correct test for
> infinite argument.
> * sysdeps/ieee754/ldbl-96/s_sinl.c (__sinl): Likewise.
> * sysdeps/ieee754/dbl-64/k_rem_pio2.c: Handle __FLT_EVAL_METHOD__
> != 0 for prec == 2.
> * sysdeps/i386/fpu/e_rem_pio2l.c: Remove.
> * sysdeps/i386/fpu/k_rem_pio2.c: Likewise.
> * sysdeps/i386/fpu/s_cosl.S: Likewise.
> * sysdeps/i386/fpu/s_sincosl.S: Likewise.
> * sysdeps/i386/fpu/s_sinl.S: Likewise.
> * sysdeps/x86_64/fpu/e_rem_pio2l.c: Likewise.
> * sysdeps/x86_64/fpu/k_cosl.c: Likewise.
> * sysdeps/x86_64/fpu/k_sinl.c: Likewise.
> * sysdeps/x86_64/fpu/s_cosl.S: Likewise.
> * sysdeps/x86_64/fpu/s_sincosl.S: Likewise.
> * sysdeps/x86_64/fpu/s_sinl.S: Likewise.
> * math/libm-test.inc (cos_test): Add more tests and enable more
> tests for long double.
> (sin_test): Likewise.
> (sincos_test): Likewise.
> * sysdeps/i386/fpu/libm-test-ulps: Update.
> * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Wow, thanks a lot! I would like to see Jakub review the ported routines
as he's the original author - to me it looks fine,
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
More information about the Libc-alpha
mailing list