Re: [PATCH 4/4] math: Fix inaccurate sin/cos/tan for large arguments (BZ 34376)

Carlos O'Donell <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Red Hat, LLC.
Message-ID <[email protected]>
On 7/16/26 5:21 PM, Adhemerval Zanella wrote:
> The Payne-Hanek range reducer __branred delivers the reduced argument
> as a double-double with only about 93 significant bits.  For arguments
> extremely close to a multiple of pi/2 the true reduced argument can be
> as small as 2^-61, so most of those bits cancel and sin/cos/tan can be
> wrong by up to ~143000 ulp.  This inaccuracy used to be handled by the
> multiple-precision slow paths, which was removed by by commit

s/by by/by/g

Detected by LLM.

> 649095838b8 ("sin/cos slow paths: remove slow paths from huge range
> reduction") and commit 476d692e8a8 ("math: Remove slow paths in tan
> [BZ #15267]").
> 
> Restore the fdlibm e_rem_pio2.c (removed as unused by commit
> ca3aac57efa "Remove unused math files") and use __ieee754_rem_pio2 for
> the huge-argument reduction instead of __branred, which is removed.
> 
> It also does not depend on precise IEEE double rounding, so the nofma
> and vector-width workarounds for branred.c are no longer needed.
> 
> The file is restored trimmed to its huge-argument path, the callers
> reduce smaller arguments themselves and handle non-finite inputs, so
> only 1e8 < |x| < 2^1024 reaches __ieee754_rem_pio2.
> 
> Checked on x86_64-linux-gnu, aarch64-linux-gnu, armv7a-linux-gnueabihf,
> and i686-linux-gnu.

LGTM.

You can keep my RB if you adjust the minor typo.

Reviewed-by: Carlos O'Donell <[email protected]>

> ---
>   math/Makefile                        |   2 +-
>   math/auto-libm-test-in               |  17 ++
>   math/auto-libm-test-out-cos          | 252 +++++++++++++++++++++++++++
>   math/auto-libm-test-out-sin          | 228 ++++++++++++++++++++++++
>   math/auto-libm-test-out-tan          | 183 +++++++++++++++++++
>   sysdeps/generic/math_private.h       |   1 -
>   sysdeps/ieee754/dbl-64/Makefile      |   2 -
>   sysdeps/ieee754/dbl-64/branred.c     | 143 ---------------
>   sysdeps/ieee754/dbl-64/branred.h     |  79 ---------
>   sysdeps/ieee754/dbl-64/e_rem_pio2.c  |  76 ++++++++
>   sysdeps/ieee754/dbl-64/s_sin.c       |  14 +-
>   sysdeps/ieee754/dbl-64/s_sincos.c    |  10 +-
>   sysdeps/ieee754/dbl-64/s_tan.c       |  11 +-
>   sysdeps/m68k/m680x0/fpu/e_rem_pio2.c |   1 +
>   sysdeps/x86_64/fpu/Makefile          |  12 --
>   15 files changed, 780 insertions(+), 251 deletions(-)
>   delete mode 100644 sysdeps/ieee754/dbl-64/branred.c
>   delete mode 100644 sysdeps/ieee754/dbl-64/branred.h
>   create mode 100644 sysdeps/ieee754/dbl-64/e_rem_pio2.c
>   create mode 100644 sysdeps/m68k/m680x0/fpu/e_rem_pio2.c
> 
> diff --git a/math/Makefile b/math/Makefile
> index 7a9352c2cd6..5b48e533002 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -358,13 +358,13 @@ type-ldouble-yes := ldouble
>   # double support
>   type-double-suffix :=
>   type-double-routines := \
> -  branred \
>     e_cosh_data \
>     e_coshsinh_data \
>     e_exp_data \
>     e_log2_data \
>     e_log_data \
>     e_pow_log_data \
> +  e_rem_pio2 \
>     e_sinh_data \
>     e_tanh_data \
>     k_rem_pio2 \
> diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> index c2c57523e48..73737235de2 100644
> --- a/math/auto-libm-test-in
> +++ b/math/auto-libm-test-in
> @@ -5061,6 +5061,12 @@ cos -1.57079697
>   cos 0x2.3c6ef4p-12
>   # the next value generates larger error bounds on x86_64 (binary128)
>   cos 0xe.6672d458b05edf50af4fab1a42p+40
> +# Large arguments close to a multiple of pi/2, stressing the range reducer
> +# (bug 34376).
> +cos 0x1.69eab0985179bp+246
> +cos 0x1.8577cec54ab8p+47
> +cos 0x1.dbd58768f97p+45
> +cos 0x1.0e826ceb0c5cp+46

OK. Nice add back more tests.

>   
>   cospi 0
>   cospi -0
> @@ -9491,6 +9497,12 @@ sin 0x1.d12ed2p-12
>   sin -0x6.e2368c006c018228p+16
>   # the next value generates larger error bounds on x86_64 (binary128)
>   sin 0x5.6a5005df4363833413fa44f74ae8p+64
> +# Large arguments close to a multiple of pi/2, stressing the range reducer
> +# (bug 34376).
> +sin 0x1.4c96c11134d36p+578
> +sin 0x1.69eab0985179bp+246
> +sin 0x1.2419db13f80ap+50
> +sin 0x1.0e826ceb0c5cp+47
>   sin max
>   sin -max
>   sin min
> @@ -10007,6 +10019,11 @@ tan 0x1p-60
>   tan 0x1p-100
>   tan 0x1p-600
>   tan 0x1p-10000
> +# Large arguments close to a multiple of pi/2, stressing the range reducer
> +# (bug 34376).
> +tan 0x1.69eab0985179bp+246
> +tan 0x1.8577cec54ab8p+47
> +tan 0x1.dbd58768f97p+45
>   tan max
>   tan -max
>   tan min
> diff --git a/math/auto-libm-test-out-cos b/math/auto-libm-test-out-cos
> index 795a6eb447a..eee17d057c3 100644
> --- a/math/auto-libm-test-out-cos
> +++ b/math/auto-libm-test-out-cos
> @@ -3389,3 +3389,255 @@ cos 0xe.6672d458b05edf50af4fab1a42p+40
>   = cos tonearest ibm128 0xe.6672d458b05edf50af4fab1a4p+40 : 0x1.ff56b710bf1d3d367f604dfafap-4 : inexact-ok
>   = cos towardzero ibm128 0xe.6672d458b05edf50af4fab1a4p+40 : 0x1.ff56b710bf1d3d367f604dfafap-4 : inexact-ok
>   = cos upward ibm128 0xe.6672d458b05edf50af4fab1a4p+40 : 0x1.ff56b710bf1d3d367f604dfafa8p-4 : inexact-ok
> +cos 0x1.69eab0985179bp+246
> += cos downward binary32 0xf.fffffp+124 : 0xd.a5f96p-4 : inexact-ok
> += cos tonearest binary32 0xf.fffffp+124 : 0xd.a5f96p-4 : inexact-ok
> += cos towardzero binary32 0xf.fffffp+124 : 0xd.a5f96p-4 : inexact-ok
> += cos upward binary32 0xf.fffffp+124 : 0xd.a5f97p-4 : inexact-ok
> += cos downward binary64 0xf.fffffp+124 : 0xd.a5f963cdefe68p-4 : inexact-ok
> += cos tonearest binary64 0xf.fffffp+124 : 0xd.a5f963cdefe7p-4 : inexact-ok
> += cos towardzero binary64 0xf.fffffp+124 : 0xd.a5f963cdefe68p-4 : inexact-ok
> += cos upward binary64 0xf.fffffp+124 : 0xd.a5f963cdefe7p-4 : inexact-ok
> += cos downward intel96 0xf.fffffp+124 : 0xd.a5f963cdefe6d52p-4 : inexact-ok
> += cos tonearest intel96 0xf.fffffp+124 : 0xd.a5f963cdefe6d53p-4 : inexact-ok
> += cos towardzero intel96 0xf.fffffp+124 : 0xd.a5f963cdefe6d52p-4 : inexact-ok
> += cos upward intel96 0xf.fffffp+124 : 0xd.a5f963cdefe6d53p-4 : inexact-ok
> += cos downward m68k96 0xf.fffffp+124 : 0xd.a5f963cdefe6d52p-4 : inexact-ok
> += cos tonearest m68k96 0xf.fffffp+124 : 0xd.a5f963cdefe6d53p-4 : inexact-ok
> += cos towardzero m68k96 0xf.fffffp+124 : 0xd.a5f963cdefe6d52p-4 : inexact-ok
> += cos upward m68k96 0xf.fffffp+124 : 0xd.a5f963cdefe6d53p-4 : inexact-ok
> += cos downward binary128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb2fp-4 : inexact-ok
> += cos tonearest binary128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb2fp-4 : inexact-ok
> += cos towardzero binary128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb2fp-4 : inexact-ok
> += cos upward binary128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb2f8p-4 : inexact-ok
> += cos downward ibm128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fbp-4 : inexact-ok
> += cos tonearest ibm128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb4p-4 : inexact-ok
> += cos towardzero ibm128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fbp-4 : inexact-ok
> += cos upward ibm128 0xf.fffffp+124 : 0xd.a5f963cdefe6d529f6b6009fb4p-4 : inexact-ok
> += cos downward binary64 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff8p-60 : inexact-ok
> += cos tonearest binary64 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4p-60 : inexact-ok
> += cos towardzero binary64 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4p-60 : inexact-ok
> += cos upward binary64 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4p-60 : inexact-ok
> += cos downward intel96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa8p-60 : inexact-ok
> += cos tonearest intel96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa8p-60 : inexact-ok
> += cos towardzero intel96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fap-60 : inexact-ok
> += cos upward intel96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fap-60 : inexact-ok
> += cos downward m68k96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa8p-60 : inexact-ok
> += cos tonearest m68k96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa8p-60 : inexact-ok
> += cos towardzero m68k96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fap-60 : inexact-ok
> += cos upward m68k96 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fap-60 : inexact-ok
> += cos downward binary128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54c08p-60 : inexact-ok
> += cos tonearest binary128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54c08p-60 : inexact-ok
> += cos towardzero binary128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54c04p-60 : inexact-ok
> += cos upward binary128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54c04p-60 : inexact-ok
> += cos downward ibm128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54ep-60 : inexact-ok
> += cos tonearest ibm128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54cp-60 : inexact-ok
> += cos towardzero ibm128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54cp-60 : inexact-ok
> += cos upward ibm128 0x5.a7aac26145e6cp+244 : -0x5.87b3b2715dff4fa463303df54cp-60 : inexact-ok
> +cos 0x1.8577cec54ab8p+47
> += cos downward binary32 0xc.2bbe8p+44 : -0x6.99b478p-4 : inexact-ok
> += cos tonearest binary32 0xc.2bbe8p+44 : -0x6.99b47p-4 : inexact-ok
> += cos towardzero binary32 0xc.2bbe8p+44 : -0x6.99b47p-4 : inexact-ok
> += cos upward binary32 0xc.2bbe8p+44 : -0x6.99b47p-4 : inexact-ok
> += cos downward binary64 0xc.2bbe8p+44 : -0x6.99b47311dbff4p-4 : inexact-ok
> += cos tonearest binary64 0xc.2bbe8p+44 : -0x6.99b47311dbff4p-4 : inexact-ok
> += cos towardzero binary64 0xc.2bbe8p+44 : -0x6.99b47311dbffp-4 : inexact-ok
> += cos upward binary64 0xc.2bbe8p+44 : -0x6.99b47311dbffp-4 : inexact-ok
> += cos downward intel96 0xc.2bbe8p+44 : -0x6.99b47311dbff313p-4 : inexact-ok
> += cos tonearest intel96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos towardzero intel96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos upward intel96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos downward m68k96 0xc.2bbe8p+44 : -0x6.99b47311dbff313p-4 : inexact-ok
> += cos tonearest m68k96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos towardzero m68k96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos upward m68k96 0xc.2bbe8p+44 : -0x6.99b47311dbff3128p-4 : inexact-ok
> += cos downward binary128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b70ecp-4 : inexact-ok
> += cos tonearest binary128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b70e8p-4 : inexact-ok
> += cos towardzero binary128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b70e8p-4 : inexact-ok
> += cos upward binary128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b70e8p-4 : inexact-ok
> += cos downward ibm128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b72p-4 : inexact-ok
> += cos tonearest ibm128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b7p-4 : inexact-ok
> += cos towardzero ibm128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b7p-4 : inexact-ok
> += cos upward ibm128 0xc.2bbe8p+44 : -0x6.99b47311dbff3129fdf4b31b7p-4 : inexact-ok
> += cos downward binary32 0xc.2bbe7p+44 : 0x7.3a6f2p-4 : inexact-ok
> += cos tonearest binary32 0xc.2bbe7p+44 : 0x7.3a6f2p-4 : inexact-ok
> += cos towardzero binary32 0xc.2bbe7p+44 : 0x7.3a6f2p-4 : inexact-ok
> += cos upward binary32 0xc.2bbe7p+44 : 0x7.3a6f28p-4 : inexact-ok
> += cos downward binary64 0xc.2bbe7p+44 : 0x7.3a6f2368ae644p-4 : inexact-ok
> += cos tonearest binary64 0xc.2bbe7p+44 : 0x7.3a6f2368ae644p-4 : inexact-ok
> += cos towardzero binary64 0xc.2bbe7p+44 : 0x7.3a6f2368ae644p-4 : inexact-ok
> += cos upward binary64 0xc.2bbe7p+44 : 0x7.3a6f2368ae648p-4 : inexact-ok
> += cos downward intel96 0xc.2bbe7p+44 : 0x7.3a6f2368ae644188p-4 : inexact-ok
> += cos tonearest intel96 0xc.2bbe7p+44 : 0x7.3a6f2368ae64419p-4 : inexact-ok
> += cos towardzero intel96 0xc.2bbe7p+44 : 0x7.3a6f2368ae644188p-4 : inexact-ok
> += cos upward intel96 0xc.2bbe7p+44 : 0x7.3a6f2368ae64419p-4 : inexact-ok
> += cos downward m68k96 0xc.2bbe7p+44 : 0x7.3a6f2368ae644188p-4 : inexact-ok
> += cos tonearest m68k96 0xc.2bbe7p+44 : 0x7.3a6f2368ae64419p-4 : inexact-ok
> += cos towardzero m68k96 0xc.2bbe7p+44 : 0x7.3a6f2368ae644188p-4 : inexact-ok
> += cos upward m68k96 0xc.2bbe7p+44 : 0x7.3a6f2368ae64419p-4 : inexact-ok
> += cos downward binary128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be99ccp-4 : inexact-ok
> += cos tonearest binary128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be99ccp-4 : inexact-ok
> += cos towardzero binary128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be99ccp-4 : inexact-ok
> += cos upward binary128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be99dp-4 : inexact-ok
> += cos downward ibm128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be98p-4 : inexact-ok
> += cos tonearest ibm128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be9ap-4 : inexact-ok
> += cos towardzero ibm128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be98p-4 : inexact-ok
> += cos upward ibm128 0xc.2bbe7p+44 : 0x7.3a6f2368ae64418f79c248be9ap-4 : inexact-ok
> += cos downward binary64 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c362p-52 : inexact-ok
> += cos tonearest binary64 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c362p-52 : inexact-ok
> += cos towardzero binary64 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c362p-52 : inexact-ok
> += cos upward binary64 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c363p-52 : inexact-ok
> += cos downward intel96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos tonearest intel96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos towardzero intel96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos upward intel96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204ep-52 : inexact-ok
> += cos downward m68k96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos tonearest m68k96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos towardzero m68k96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204cp-52 : inexact-ok
> += cos upward m68k96 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204ep-52 : inexact-ok
> += cos downward binary128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c97p-52 : inexact-ok
> += cos tonearest binary128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c97p-52 : inexact-ok
> += cos towardzero binary128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c97p-52 : inexact-ok
> += cos upward binary128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c98p-52 : inexact-ok
> += cos downward ibm128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c8p-52 : inexact-ok
> += cos tonearest ibm128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c8p-52 : inexact-ok
> += cos towardzero ibm128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322c8p-52 : inexact-ok
> += cos upward ibm128 0xc.2bbe762a55cp+44 : 0x1.2b04a1af8c36204c7ee321322dp-52 : inexact-ok
> +cos 0x1.dbd58768f97p+45
> += cos downward binary32 0x3.b7ab1p+44 : -0xe.ba3e9p-4 : inexact-ok
> += cos tonearest binary32 0x3.b7ab1p+44 : -0xe.ba3e8p-4 : inexact-ok
> += cos towardzero binary32 0x3.b7ab1p+44 : -0xe.ba3e8p-4 : inexact-ok
> += cos upward binary32 0x3.b7ab1p+44 : -0xe.ba3e8p-4 : inexact-ok
> += cos downward binary64 0x3.b7ab1p+44 : -0xe.ba3e819411018p-4 : inexact-ok
> += cos tonearest binary64 0x3.b7ab1p+44 : -0xe.ba3e81941101p-4 : inexact-ok
> += cos towardzero binary64 0x3.b7ab1p+44 : -0xe.ba3e81941101p-4 : inexact-ok
> += cos upward binary64 0x3.b7ab1p+44 : -0xe.ba3e81941101p-4 : inexact-ok
> += cos downward intel96 0x3.b7ab1p+44 : -0xe.ba3e81941101295p-4 : inexact-ok
> += cos tonearest intel96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos towardzero intel96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos upward intel96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos downward m68k96 0x3.b7ab1p+44 : -0xe.ba3e81941101295p-4 : inexact-ok
> += cos tonearest m68k96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos towardzero m68k96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos upward m68k96 0x3.b7ab1p+44 : -0xe.ba3e81941101294p-4 : inexact-ok
> += cos downward binary128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef598p-4 : inexact-ok
> += cos tonearest binary128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef598p-4 : inexact-ok
> += cos towardzero binary128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef59p-4 : inexact-ok
> += cos upward binary128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef59p-4 : inexact-ok
> += cos downward ibm128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef8p-4 : inexact-ok
> += cos tonearest ibm128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef4p-4 : inexact-ok
> += cos towardzero ibm128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef4p-4 : inexact-ok
> += cos upward ibm128 0x3.b7ab1p+44 : -0xe.ba3e819411012942be66959ef4p-4 : inexact-ok
> += cos downward binary32 0x3.b7ab0cp+44 : -0x9.5c959p-4 : inexact-ok
> += cos tonearest binary32 0x3.b7ab0cp+44 : -0x9.5c959p-4 : inexact-ok
> += cos towardzero binary32 0x3.b7ab0cp+44 : -0x9.5c958p-4 : inexact-ok
> += cos upward binary32 0x3.b7ab0cp+44 : -0x9.5c958p-4 : inexact-ok
> += cos downward binary64 0x3.b7ab0cp+44 : -0x9.5c95889665228p-4 : inexact-ok
> += cos tonearest binary64 0x3.b7ab0cp+44 : -0x9.5c9588966522p-4 : inexact-ok
> += cos towardzero binary64 0x3.b7ab0cp+44 : -0x9.5c9588966522p-4 : inexact-ok
> += cos upward binary64 0x3.b7ab0cp+44 : -0x9.5c9588966522p-4 : inexact-ok
> += cos downward intel96 0x3.b7ab0cp+44 : -0x9.5c9588966522227p-4 : inexact-ok
> += cos tonearest intel96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos towardzero intel96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos upward intel96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos downward m68k96 0x3.b7ab0cp+44 : -0x9.5c9588966522227p-4 : inexact-ok
> += cos tonearest m68k96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos towardzero m68k96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos upward m68k96 0x3.b7ab0cp+44 : -0x9.5c9588966522226p-4 : inexact-ok
> += cos downward binary128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758f28p-4 : inexact-ok
> += cos tonearest binary128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758f2p-4 : inexact-ok
> += cos towardzero binary128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758f2p-4 : inexact-ok
> += cos upward binary128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758f2p-4 : inexact-ok
> += cos downward ibm128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf759p-4 : inexact-ok
> += cos tonearest ibm128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf759p-4 : inexact-ok
> += cos towardzero ibm128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758cp-4 : inexact-ok
> += cos upward ibm128 0x3.b7ab0cp+44 : -0x9.5c95889665222264d4becf758cp-4 : inexact-ok
> += cos downward binary64 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cp-48 : inexact-ok
> += cos tonearest binary64 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cp-48 : inexact-ok
> += cos towardzero binary64 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cp-48 : inexact-ok
> += cos upward binary64 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e11p-48 : inexact-ok
> += cos downward intel96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos tonearest intel96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos towardzero intel96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos upward intel96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdcp-48 : inexact-ok
> += cos downward m68k96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos tonearest m68k96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos towardzero m68k96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8p-48 : inexact-ok
> += cos upward m68k96 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdcp-48 : inexact-ok
> += cos downward binary128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7dbcp-48 : inexact-ok
> += cos tonearest binary128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7dcp-48 : inexact-ok
> += cos towardzero binary128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7dbcp-48 : inexact-ok
> += cos upward binary128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7dcp-48 : inexact-ok
> += cos downward ibm128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7cp-48 : inexact-ok
> += cos tonearest ibm128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7ep-48 : inexact-ok
> += cos towardzero ibm128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7cp-48 : inexact-ok
> += cos upward ibm128 0x3.b7ab0ed1f2ep+44 : 0x4.1b9121100e10cdb8bee1e90f7ep-48 : inexact-ok
> +cos 0x1.0e826ceb0c5cp+46
> += cos downward binary32 0x4.3a09b8p+44 : -0xe.e7cd2p-4 : inexact-ok
> += cos tonearest binary32 0x4.3a09b8p+44 : -0xe.e7cd2p-4 : inexact-ok
> += cos towardzero binary32 0x4.3a09b8p+44 : -0xe.e7cd1p-4 : inexact-ok
> += cos upward binary32 0x4.3a09b8p+44 : -0xe.e7cd1p-4 : inexact-ok
> += cos downward binary64 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e8p-4 : inexact-ok
> += cos tonearest binary64 0x4.3a09b8p+44 : -0xe.e7cd1817fc8ep-4 : inexact-ok
> += cos towardzero binary64 0x4.3a09b8p+44 : -0xe.e7cd1817fc8ep-4 : inexact-ok
> += cos upward binary64 0x4.3a09b8p+44 : -0xe.e7cd1817fc8ep-4 : inexact-ok
> += cos downward intel96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21fp-4 : inexact-ok
> += cos tonearest intel96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21fp-4 : inexact-ok
> += cos towardzero intel96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21ep-4 : inexact-ok
> += cos upward intel96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21ep-4 : inexact-ok
> += cos downward m68k96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21fp-4 : inexact-ok
> += cos tonearest m68k96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21fp-4 : inexact-ok
> += cos towardzero m68k96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21ep-4 : inexact-ok
> += cos upward m68k96 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21ep-4 : inexact-ok
> += cos downward binary128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21eef8p-4 : inexact-ok
> += cos tonearest binary128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21eefp-4 : inexact-ok
> += cos towardzero binary128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21eefp-4 : inexact-ok
> += cos upward binary128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21eefp-4 : inexact-ok
> += cos downward ibm128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21fp-4 : inexact-ok
> += cos tonearest ibm128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21fp-4 : inexact-ok
> += cos towardzero ibm128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21ecp-4 : inexact-ok
> += cos upward ibm128 0x4.3a09b8p+44 : -0xe.e7cd1817fc8e21eeeeb86b21ecp-4 : inexact-ok
> += cos downward binary32 0x4.3a09bp+44 : 0xa.ed559p-4 : inexact-ok
> += cos tonearest binary32 0x4.3a09bp+44 : 0xa.ed559p-4 : inexact-ok
> += cos towardzero binary32 0x4.3a09bp+44 : 0xa.ed559p-4 : inexact-ok
> += cos upward binary32 0x4.3a09bp+44 : 0xa.ed55ap-4 : inexact-ok
> += cos downward binary64 0x4.3a09bp+44 : 0xa.ed55933cc4ab8p-4 : inexact-ok
> += cos tonearest binary64 0x4.3a09bp+44 : 0xa.ed55933cc4acp-4 : inexact-ok
> += cos towardzero binary64 0x4.3a09bp+44 : 0xa.ed55933cc4ab8p-4 : inexact-ok
> += cos upward binary64 0x4.3a09bp+44 : 0xa.ed55933cc4acp-4 : inexact-ok
> += cos downward intel96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos tonearest intel96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos towardzero intel96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos upward intel96 0x4.3a09bp+44 : 0xa.ed55933cc4abe87p-4 : inexact-ok
> += cos downward m68k96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos tonearest m68k96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos towardzero m68k96 0x4.3a09bp+44 : 0xa.ed55933cc4abe86p-4 : inexact-ok
> += cos upward m68k96 0x4.3a09bp+44 : 0xa.ed55933cc4abe87p-4 : inexact-ok
> += cos downward binary128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504ecdbp-4 : inexact-ok
> += cos tonearest binary128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504ecdb8p-4 : inexact-ok
> += cos towardzero binary128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504ecdbp-4 : inexact-ok
> += cos upward binary128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504ecdb8p-4 : inexact-ok
> += cos downward ibm128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504eccp-4 : inexact-ok
> += cos tonearest ibm128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504eccp-4 : inexact-ok
> += cos towardzero ibm128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504eccp-4 : inexact-ok
> += cos upward ibm128 0x4.3a09bp+44 : 0xa.ed55933cc4abe860b7fe504edp-4 : inexact-ok
> += cos downward binary64 0x4.3a09b3ac317p+44 : -0x2.1720b595836a2p-48 : inexact-ok
> += cos tonearest binary64 0x4.3a09b3ac317p+44 : -0x2.1720b595836a2p-48 : inexact-ok
> += cos towardzero binary64 0x4.3a09b3ac317p+44 : -0x2.1720b595836ap-48 : inexact-ok
> += cos upward binary64 0x4.3a09b3ac317p+44 : -0x2.1720b595836ap-48 : inexact-ok
> += cos downward intel96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17ep-48 : inexact-ok
> += cos tonearest intel96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17ep-48 : inexact-ok
> += cos towardzero intel96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dcp-48 : inexact-ok
> += cos upward intel96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dcp-48 : inexact-ok
> += cos downward m68k96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17ep-48 : inexact-ok
> += cos tonearest m68k96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17ep-48 : inexact-ok
> += cos towardzero m68k96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dcp-48 : inexact-ok
> += cos upward m68k96 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dcp-48 : inexact-ok
> += cos downward binary128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d95912ap-48 : inexact-ok
> += cos tonearest binary128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d959128p-48 : inexact-ok
> += cos towardzero binary128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d959128p-48 : inexact-ok
> += cos upward binary128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d959128p-48 : inexact-ok
> += cos downward ibm128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d9592p-48 : inexact-ok
> += cos tonearest ibm128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d9591p-48 : inexact-ok
> += cos towardzero ibm128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d9591p-48 : inexact-ok
> += cos upward ibm128 0x4.3a09b3ac317p+44 : -0x2.1720b595836a17dec3680d9591p-48 : inexact-ok
> diff --git a/math/auto-libm-test-out-sin b/math/auto-libm-test-out-sin
> index f1d21b179c9..1181f057ce8 100644
> --- a/math/auto-libm-test-out-sin
> +++ b/math/auto-libm-test-out-sin
> @@ -3389,6 +3389,234 @@ sin 0x5.6a5005df4363833413fa44f74ae8p+64
>   = sin tonearest ibm128 0x5.6a5005df4363833413fa44f74ap+64 : -0xf.fdc305247e694b390edb67a7fcp-8 : inexact-ok
>   = sin towardzero ibm128 0x5.6a5005df4363833413fa44f74ap+64 : -0xf.fdc305247e694b390edb67a7f8p-8 : inexact-ok
>   = sin upward ibm128 0x5.6a5005df4363833413fa44f74ap+64 : -0xf.fdc305247e694b390edb67a7f8p-8 : inexact-ok
> +sin 0x1.4c96c11134d36p+578
> += sin downward binary32 0xf.fffffp+124 : -0x8.599b4p-4 : inexact-ok
> += sin tonearest binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin towardzero binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin upward binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin downward binary64 0xf.fffffp+124 : -0x8.599b32844abbp-4 : inexact-ok
> += sin tonearest binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin towardzero binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin upward binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin downward intel96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin tonearest intel96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin towardzero intel96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin upward intel96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin downward m68k96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin tonearest m68k96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin towardzero m68k96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin upward m68k96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin downward binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be049ap-4 : inexact-ok
> += sin tonearest binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin towardzero binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin upward binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin downward ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04cp-4 : inexact-ok
> += sin tonearest ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin towardzero ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin upward ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin downward binary64 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd48cp-60 : inexact-ok
> += sin tonearest binary64 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd488p-60 : inexact-ok
> += sin towardzero binary64 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd488p-60 : inexact-ok
> += sin upward binary64 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd488p-60 : inexact-ok
> += sin downward intel96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f8p-60 : inexact-ok
> += sin tonearest intel96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin towardzero intel96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin upward intel96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin downward m68k96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f8p-60 : inexact-ok
> += sin tonearest m68k96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin towardzero m68k96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin upward m68k96 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892fp-60 : inexact-ok
> += sin downward binary128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000a84p-60 : inexact-ok
> += sin tonearest binary128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000a84p-60 : inexact-ok
> += sin towardzero binary128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000a8p-60 : inexact-ok
> += sin upward binary128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000a8p-60 : inexact-ok
> += sin downward ibm128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000cp-60 : inexact-ok
> += sin tonearest ibm128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000ap-60 : inexact-ok
> += sin towardzero ibm128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000ap-60 : inexact-ok
> += sin upward ibm128 0x5.325b0444d34d8p+576 : -0x5.bb19ef3ddd4892f2b3c334000ap-60 : inexact-ok
> +sin 0x1.69eab0985179bp+246
> += sin downward binary32 0xf.fffffp+124 : -0x8.599b4p-4 : inexact-ok
> += sin tonearest binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin towardzero binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin upward binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> += sin downward binary64 0xf.fffffp+124 : -0x8.599b32844abbp-4 : inexact-ok
> += sin tonearest binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin towardzero binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin upward binary64 0xf.fffffp+124 : -0x8.599b32844aba8p-4 : inexact-ok
> += sin downward intel96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin tonearest intel96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin towardzero intel96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin upward intel96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin downward m68k96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin tonearest m68k96 0xf.fffffp+124 : -0x8.599b32844aba907p-4 : inexact-ok
> += sin towardzero m68k96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin upward m68k96 0xf.fffffp+124 : -0x8.599b32844aba906p-4 : inexact-ok
> += sin downward binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be049ap-4 : inexact-ok
> += sin tonearest binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin towardzero binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin upward binary128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04998p-4 : inexact-ok
> += sin downward ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be04cp-4 : inexact-ok
> += sin tonearest ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin towardzero ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin upward ibm128 0xf.fffffp+124 : -0x8.599b32844aba906cee446be048p-4 : inexact-ok
> += sin downward binary64 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin tonearest binary64 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin towardzero binary64 0x5.a7aac26145e6cp+244 : -0xf.ffffffffffff8p-4 : inexact-ok
> += sin upward binary64 0x5.a7aac26145e6cp+244 : -0xf.ffffffffffff8p-4 : inexact-ok
> += sin downward intel96 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin tonearest intel96 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin towardzero intel96 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffp-4 : inexact-ok
> += sin upward intel96 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffp-4 : inexact-ok
> += sin downward m68k96 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin tonearest m68k96 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin towardzero m68k96 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffp-4 : inexact-ok
> += sin upward m68k96 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffp-4 : inexact-ok
> += sin downward binary128 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin tonearest binary128 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin towardzero binary128 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffffffffffffff8p-4 : inexact-ok
> += sin upward binary128 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffffffffffffff8p-4 : inexact-ok
> += sin downward ibm128 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin tonearest ibm128 0x5.a7aac26145e6cp+244 : -0x1p+0 : inexact-ok
> += sin towardzero ibm128 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffffffffffffcp-4 : inexact-ok
> += sin upward ibm128 0x5.a7aac26145e6cp+244 : -0xf.fffffffffffffffffffffffffcp-4 : inexact-ok
> +sin 0x1.2419db13f80ap+50
> += sin downward binary32 0x4.90677p+48 : 0x8.e7af1p-4 : inexact-ok
> += sin tonearest binary32 0x4.90677p+48 : 0x8.e7af1p-4 : inexact-ok
> += sin towardzero binary32 0x4.90677p+48 : 0x8.e7af1p-4 : inexact-ok
> += sin upward binary32 0x4.90677p+48 : 0x8.e7af2p-4 : inexact-ok
> += sin downward binary64 0x4.90677p+48 : 0x8.e7af14b5e0968p-4 : inexact-ok
> += sin tonearest binary64 0x4.90677p+48 : 0x8.e7af14b5e0968p-4 : inexact-ok
> += sin towardzero binary64 0x4.90677p+48 : 0x8.e7af14b5e0968p-4 : inexact-ok
> += sin upward binary64 0x4.90677p+48 : 0x8.e7af14b5e097p-4 : inexact-ok
> += sin downward intel96 0x4.90677p+48 : 0x8.e7af14b5e096b1dp-4 : inexact-ok
> += sin tonearest intel96 0x4.90677p+48 : 0x8.e7af14b5e096b1ep-4 : inexact-ok
> += sin towardzero intel96 0x4.90677p+48 : 0x8.e7af14b5e096b1dp-4 : inexact-ok
> += sin upward intel96 0x4.90677p+48 : 0x8.e7af14b5e096b1ep-4 : inexact-ok
> += sin downward m68k96 0x4.90677p+48 : 0x8.e7af14b5e096b1dp-4 : inexact-ok
> += sin tonearest m68k96 0x4.90677p+48 : 0x8.e7af14b5e096b1ep-4 : inexact-ok
> += sin towardzero m68k96 0x4.90677p+48 : 0x8.e7af14b5e096b1dp-4 : inexact-ok
> += sin upward m68k96 0x4.90677p+48 : 0x8.e7af14b5e096b1ep-4 : inexact-ok
> += sin downward binary128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ca18p-4 : inexact-ok
> += sin tonearest binary128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ca2p-4 : inexact-ok
> += sin towardzero binary128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ca18p-4 : inexact-ok
> += sin upward binary128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ca2p-4 : inexact-ok
> += sin downward ibm128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006c8p-4 : inexact-ok
> += sin tonearest ibm128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ccp-4 : inexact-ok
> += sin towardzero ibm128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006c8p-4 : inexact-ok
> += sin upward ibm128 0x4.90677p+48 : 0x8.e7af14b5e096b1de0542a006ccp-4 : inexact-ok
> += sin downward binary32 0x4.906768p+48 : 0xf.e657bp-4 : inexact-ok
> += sin tonearest binary32 0x4.906768p+48 : 0xf.e657cp-4 : inexact-ok
> += sin towardzero binary32 0x4.906768p+48 : 0xf.e657bp-4 : inexact-ok
> += sin upward binary32 0x4.906768p+48 : 0xf.e657cp-4 : inexact-ok
> += sin downward binary64 0x4.906768p+48 : 0xf.e657b8243a248p-4 : inexact-ok
> += sin tonearest binary64 0x4.906768p+48 : 0xf.e657b8243a25p-4 : inexact-ok
> += sin towardzero binary64 0x4.906768p+48 : 0xf.e657b8243a248p-4 : inexact-ok
> += sin upward binary64 0x4.906768p+48 : 0xf.e657b8243a25p-4 : inexact-ok
> += sin downward intel96 0x4.906768p+48 : 0xf.e657b8243a24e71p-4 : inexact-ok
> += sin tonearest intel96 0x4.906768p+48 : 0xf.e657b8243a24e72p-4 : inexact-ok
> += sin towardzero intel96 0x4.906768p+48 : 0xf.e657b8243a24e71p-4 : inexact-ok
> += sin upward intel96 0x4.906768p+48 : 0xf.e657b8243a24e72p-4 : inexact-ok
> += sin downward m68k96 0x4.906768p+48 : 0xf.e657b8243a24e71p-4 : inexact-ok
> += sin tonearest m68k96 0x4.906768p+48 : 0xf.e657b8243a24e72p-4 : inexact-ok
> += sin towardzero m68k96 0x4.906768p+48 : 0xf.e657b8243a24e71p-4 : inexact-ok
> += sin upward m68k96 0x4.906768p+48 : 0xf.e657b8243a24e72p-4 : inexact-ok
> += sin downward binary128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec127p-4 : inexact-ok
> += sin tonearest binary128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec127p-4 : inexact-ok
> += sin towardzero binary128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec127p-4 : inexact-ok
> += sin upward binary128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec1278p-4 : inexact-ok
> += sin downward ibm128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec1p-4 : inexact-ok
> += sin tonearest ibm128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec14p-4 : inexact-ok
> += sin towardzero ibm128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec1p-4 : inexact-ok
> += sin upward ibm128 0x4.906768p+48 : 0xf.e657b8243a24e71ea65806ec14p-4 : inexact-ok
> += sin downward binary64 0x4.90676c4fe028p+48 : 0x7.021bca1d4944cp-52 : inexact-ok
> += sin tonearest binary64 0x4.90676c4fe028p+48 : 0x7.021bca1d4944cp-52 : inexact-ok
> += sin towardzero binary64 0x4.90676c4fe028p+48 : 0x7.021bca1d4944cp-52 : inexact-ok
> += sin upward binary64 0x4.90676c4fe028p+48 : 0x7.021bca1d4945p-52 : inexact-ok
> += sin downward intel96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin tonearest intel96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin towardzero intel96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin upward intel96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1dp-52 : inexact-ok
> += sin downward m68k96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin tonearest m68k96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin towardzero m68k96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1c8p-52 : inexact-ok
> += sin upward m68k96 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1dp-52 : inexact-ok
> += sin downward binary128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd3c4p-52 : inexact-ok
> += sin tonearest binary128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd3c4p-52 : inexact-ok
> += sin towardzero binary128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd3c4p-52 : inexact-ok
> += sin upward binary128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd3c8p-52 : inexact-ok
> += sin downward ibm128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd2p-52 : inexact-ok
> += sin tonearest ibm128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd4p-52 : inexact-ok
> += sin towardzero ibm128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd2p-52 : inexact-ok
> += sin upward ibm128 0x4.90676c4fe028p+48 : 0x7.021bca1d4944c1caf952c72cd4p-52 : inexact-ok
> +sin 0x1.0e826ceb0c5cp+47
> += sin downward binary32 0x8.74137p+44 : 0xa.d621p-4 : inexact-ok
> += sin tonearest binary32 0x8.74137p+44 : 0xa.d621p-4 : inexact-ok
> += sin towardzero binary32 0x8.74137p+44 : 0xa.d621p-4 : inexact-ok
> += sin upward binary32 0x8.74137p+44 : 0xa.d6211p-4 : inexact-ok
> += sin downward binary64 0x8.74137p+44 : 0xa.d6210085759ep-4 : inexact-ok
> += sin tonearest binary64 0x8.74137p+44 : 0xa.d6210085759ep-4 : inexact-ok
> += sin towardzero binary64 0x8.74137p+44 : 0xa.d6210085759ep-4 : inexact-ok
> += sin upward binary64 0x8.74137p+44 : 0xa.d6210085759e8p-4 : inexact-ok
> += sin downward intel96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin tonearest intel96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin towardzero intel96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin upward intel96 0x8.74137p+44 : 0xa.d6210085759e2ccp-4 : inexact-ok
> += sin downward m68k96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin tonearest m68k96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin towardzero m68k96 0x8.74137p+44 : 0xa.d6210085759e2cbp-4 : inexact-ok
> += sin upward m68k96 0x8.74137p+44 : 0xa.d6210085759e2ccp-4 : inexact-ok
> += sin downward binary128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240e138p-4 : inexact-ok
> += sin tonearest binary128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240e14p-4 : inexact-ok
> += sin towardzero binary128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240e138p-4 : inexact-ok
> += sin upward binary128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240e14p-4 : inexact-ok
> += sin downward ibm128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240ep-4 : inexact-ok
> += sin tonearest ibm128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240ep-4 : inexact-ok
> += sin towardzero ibm128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240ep-4 : inexact-ok
> += sin upward ibm128 0x8.74137p+44 : 0xa.d6210085759e2cb2d319f240e4p-4 : inexact-ok
> += sin downward binary32 0x8.74136p+44 : 0xf.f6bf4p-4 : inexact-ok
> += sin tonearest binary32 0x8.74136p+44 : 0xf.f6bf5p-4 : inexact-ok
> += sin towardzero binary32 0x8.74136p+44 : 0xf.f6bf4p-4 : inexact-ok
> += sin upward binary32 0x8.74136p+44 : 0xf.f6bf5p-4 : inexact-ok
> += sin downward binary64 0x8.74136p+44 : 0xf.f6bf482d31f1p-4 : inexact-ok
> += sin tonearest binary64 0x8.74136p+44 : 0xf.f6bf482d31f18p-4 : inexact-ok
> += sin towardzero binary64 0x8.74136p+44 : 0xf.f6bf482d31f1p-4 : inexact-ok
> += sin upward binary64 0x8.74136p+44 : 0xf.f6bf482d31f18p-4 : inexact-ok
> += sin downward intel96 0x8.74136p+44 : 0xf.f6bf482d31f1417p-4 : inexact-ok
> += sin tonearest intel96 0x8.74136p+44 : 0xf.f6bf482d31f1418p-4 : inexact-ok
> += sin towardzero intel96 0x8.74136p+44 : 0xf.f6bf482d31f1417p-4 : inexact-ok
> += sin upward intel96 0x8.74136p+44 : 0xf.f6bf482d31f1418p-4 : inexact-ok
> += sin downward m68k96 0x8.74136p+44 : 0xf.f6bf482d31f1417p-4 : inexact-ok
> += sin tonearest m68k96 0x8.74136p+44 : 0xf.f6bf482d31f1418p-4 : inexact-ok
> += sin towardzero m68k96 0x8.74136p+44 : 0xf.f6bf482d31f1417p-4 : inexact-ok
> += sin upward m68k96 0x8.74136p+44 : 0xf.f6bf482d31f1418p-4 : inexact-ok
> += sin downward binary128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b74918p-4 : inexact-ok
> += sin tonearest binary128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b74918p-4 : inexact-ok
> += sin towardzero binary128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b74918p-4 : inexact-ok
> += sin upward binary128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b7492p-4 : inexact-ok
> += sin downward ibm128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b748p-4 : inexact-ok
> += sin tonearest ibm128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b748p-4 : inexact-ok
> += sin towardzero ibm128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b748p-4 : inexact-ok
> += sin upward ibm128 0x8.74136p+44 : 0xf.f6bf482d31f1417ad55755b74cp-4 : inexact-ok
> += sin downward binary64 0x8.7413675862ep+44 : 0x4.2e416b2b06d4p-48 : inexact-ok
> += sin tonearest binary64 0x8.7413675862ep+44 : 0x4.2e416b2b06d44p-48 : inexact-ok
> += sin towardzero binary64 0x8.7413675862ep+44 : 0x4.2e416b2b06d4p-48 : inexact-ok
> += sin upward binary64 0x8.7413675862ep+44 : 0x4.2e416b2b06d44p-48 : inexact-ok
> += sin downward intel96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fb8p-48 : inexact-ok
> += sin tonearest intel96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fcp-48 : inexact-ok
> += sin towardzero intel96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fb8p-48 : inexact-ok
> += sin upward intel96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fcp-48 : inexact-ok
> += sin downward m68k96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fb8p-48 : inexact-ok
> += sin tonearest m68k96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fcp-48 : inexact-ok
> += sin towardzero m68k96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fb8p-48 : inexact-ok
> += sin upward m68k96 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fcp-48 : inexact-ok
> += sin downward binary128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22000cp-48 : inexact-ok
> += sin tonearest binary128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22001p-48 : inexact-ok
> += sin towardzero binary128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22000cp-48 : inexact-ok
> += sin upward binary128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22001p-48 : inexact-ok
> += sin downward ibm128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22p-48 : inexact-ok
> += sin tonearest ibm128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22p-48 : inexact-ok
> += sin towardzero ibm128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b22p-48 : inexact-ok
> += sin upward ibm128 0x8.7413675862ep+44 : 0x4.2e416b2b06d42fbd86d01b2202p-48 : inexact-ok
>   sin max
>   = sin downward binary32 0xf.fffffp+124 : -0x8.599b4p-4 : inexact-ok
>   = sin tonearest binary32 0xf.fffffp+124 : -0x8.599b3p-4 : inexact-ok
> diff --git a/math/auto-libm-test-out-tan b/math/auto-libm-test-out-tan
> index 1d5999ab90d..7da92d58e23 100644
> --- a/math/auto-libm-test-out-tan
> +++ b/math/auto-libm-test-out-tan
> @@ -3032,6 +3032,189 @@ tan 0x1p-10000
>   = tan tonearest binary128 0x1p-10000 : 0x1p-10000 : inexact-ok
>   = tan towardzero binary128 0x1p-10000 : 0x1p-10000 : inexact-ok
>   = tan upward binary128 0x1p-10000 : 0x1.0000000000000000000000000001p-10000 : inexact-ok
> +tan 0x1.69eab0985179bp+246
> += tan downward binary32 0xf.fffffp+124 : -0x9.c9ecbp-4 : inexact-ok
> += tan tonearest binary32 0xf.fffffp+124 : -0x9.c9ecap-4 : inexact-ok
> += tan towardzero binary32 0xf.fffffp+124 : -0x9.c9ecap-4 : inexact-ok
> += tan upward binary32 0xf.fffffp+124 : -0x9.c9ecap-4 : inexact-ok
> += tan downward binary64 0xf.fffffp+124 : -0x9.c9eca5a4c461p-4 : inexact-ok
> += tan tonearest binary64 0xf.fffffp+124 : -0x9.c9eca5a4c461p-4 : inexact-ok
> += tan towardzero binary64 0xf.fffffp+124 : -0x9.c9eca5a4c4608p-4 : inexact-ok
> += tan upward binary64 0xf.fffffp+124 : -0x9.c9eca5a4c4608p-4 : inexact-ok
> += tan downward intel96 0xf.fffffp+124 : -0x9.c9eca5a4c460f93p-4 : inexact-ok
> += tan tonearest intel96 0xf.fffffp+124 : -0x9.c9eca5a4c460f93p-4 : inexact-ok
> += tan towardzero intel96 0xf.fffffp+124 : -0x9.c9eca5a4c460f92p-4 : inexact-ok
> += tan upward intel96 0xf.fffffp+124 : -0x9.c9eca5a4c460f92p-4 : inexact-ok
> += tan downward m68k96 0xf.fffffp+124 : -0x9.c9eca5a4c460f93p-4 : inexact-ok
> += tan tonearest m68k96 0xf.fffffp+124 : -0x9.c9eca5a4c460f93p-4 : inexact-ok
> += tan towardzero m68k96 0xf.fffffp+124 : -0x9.c9eca5a4c460f92p-4 : inexact-ok
> += tan upward m68k96 0xf.fffffp+124 : -0x9.c9eca5a4c460f92p-4 : inexact-ok
> += tan downward binary128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbecf58p-4 : inexact-ok
> += tan tonearest binary128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbecf5p-4 : inexact-ok
> += tan towardzero binary128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbecf5p-4 : inexact-ok
> += tan upward binary128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbecf5p-4 : inexact-ok
> += tan downward ibm128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbedp-4 : inexact-ok
> += tan tonearest ibm128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbedp-4 : inexact-ok
> += tan towardzero ibm128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbeccp-4 : inexact-ok
> += tan upward ibm128 0xf.fffffp+124 : -0x9.c9eca5a4c460f92a1a2e4fbeccp-4 : inexact-ok
> += tan downward binary64 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f5p+56 : inexact-ok
> += tan tonearest binary64 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f52p+56 : inexact-ok
> += tan towardzero binary64 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f5p+56 : inexact-ok
> += tan upward binary64 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f52p+56 : inexact-ok
> += tan downward intel96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb4p+56 : inexact-ok
> += tan tonearest intel96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb8p+56 : inexact-ok
> += tan towardzero intel96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb4p+56 : inexact-ok
> += tan upward intel96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb8p+56 : inexact-ok
> += tan downward m68k96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb4p+56 : inexact-ok
> += tan tonearest m68k96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb8p+56 : inexact-ok
> += tan towardzero m68k96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb4p+56 : inexact-ok
> += tan upward m68k96 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb8p+56 : inexact-ok
> += tan downward binary128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee72382p+56 : inexact-ok
> += tan tonearest binary128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee72382p+56 : inexact-ok
> += tan towardzero binary128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee72382p+56 : inexact-ok
> += tan upward binary128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee72384p+56 : inexact-ok
> += tan downward ibm128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee723p+56 : inexact-ok
> += tan tonearest ibm128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee724p+56 : inexact-ok
> += tan towardzero ibm128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee723p+56 : inexact-ok
> += tan upward ibm128 0x5.a7aac26145e6cp+244 : 0x2.e4acf97208f51cb67baeaee724p+56 : inexact-ok
> +tan 0x1.8577cec54ab8p+47
> += tan downward binary32 0xc.2bbe8p+44 : 0x2.354dbp+0 : inexact-ok
> += tan tonearest binary32 0xc.2bbe8p+44 : 0x2.354db4p+0 : inexact-ok
> += tan towardzero binary32 0xc.2bbe8p+44 : 0x2.354dbp+0 : inexact-ok
> += tan upward binary32 0xc.2bbe8p+44 : 0x2.354db4p+0 : inexact-ok
> += tan downward binary64 0xc.2bbe8p+44 : 0x2.354db38ca5852p+0 : inexact-ok
> += tan tonearest binary64 0xc.2bbe8p+44 : 0x2.354db38ca5852p+0 : inexact-ok
> += tan towardzero binary64 0xc.2bbe8p+44 : 0x2.354db38ca5852p+0 : inexact-ok
> += tan upward binary64 0xc.2bbe8p+44 : 0x2.354db38ca5854p+0 : inexact-ok
> += tan downward intel96 0xc.2bbe8p+44 : 0x2.354db38ca5852fcp+0 : inexact-ok
> += tan tonearest intel96 0xc.2bbe8p+44 : 0x2.354db38ca5852fc4p+0 : inexact-ok
> += tan towardzero intel96 0xc.2bbe8p+44 : 0x2.354db38ca5852fcp+0 : inexact-ok
> += tan upward intel96 0xc.2bbe8p+44 : 0x2.354db38ca5852fc4p+0 : inexact-ok
> += tan downward m68k96 0xc.2bbe8p+44 : 0x2.354db38ca5852fcp+0 : inexact-ok
> += tan tonearest m68k96 0xc.2bbe8p+44 : 0x2.354db38ca5852fc4p+0 : inexact-ok
> += tan towardzero m68k96 0xc.2bbe8p+44 : 0x2.354db38ca5852fcp+0 : inexact-ok
> += tan upward m68k96 0xc.2bbe8p+44 : 0x2.354db38ca5852fc4p+0 : inexact-ok
> += tan downward binary128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dab2p+0 : inexact-ok
> += tan tonearest binary128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dab4p+0 : inexact-ok
> += tan towardzero binary128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dab2p+0 : inexact-ok
> += tan upward binary128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dab4p+0 : inexact-ok
> += tan downward ibm128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dap+0 : inexact-ok
> += tan tonearest ibm128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dbp+0 : inexact-ok
> += tan towardzero ibm128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dap+0 : inexact-ok
> += tan upward ibm128 0xc.2bbe8p+44 : 0x2.354db38ca5852fc324d592f2dbp+0 : inexact-ok
> += tan downward binary32 0xc.2bbe7p+44 : -0x1.f98ad8p+0 : inexact-ok
> += tan tonearest binary32 0xc.2bbe7p+44 : -0x1.f98ad8p+0 : inexact-ok
> += tan towardzero binary32 0xc.2bbe7p+44 : -0x1.f98ad6p+0 : inexact-ok
> += tan upward binary32 0xc.2bbe7p+44 : -0x1.f98ad6p+0 : inexact-ok
> += tan downward binary64 0xc.2bbe7p+44 : -0x1.f98ad7344f059p+0 : inexact-ok
> += tan tonearest binary64 0xc.2bbe7p+44 : -0x1.f98ad7344f059p+0 : inexact-ok
> += tan towardzero binary64 0xc.2bbe7p+44 : -0x1.f98ad7344f058p+0 : inexact-ok
> += tan upward binary64 0xc.2bbe7p+44 : -0x1.f98ad7344f058p+0 : inexact-ok
> += tan downward intel96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2cp+0 : inexact-ok
> += tan tonearest intel96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan towardzero intel96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan upward intel96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan downward m68k96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2cp+0 : inexact-ok
> += tan tonearest m68k96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan towardzero m68k96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan upward m68k96 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2ap+0 : inexact-ok
> += tan downward binary128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038e02p+0 : inexact-ok
> += tan tonearest binary128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038e02p+0 : inexact-ok
> += tan towardzero binary128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038e01p+0 : inexact-ok
> += tan upward binary128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038e01p+0 : inexact-ok
> += tan downward ibm128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038e8p+0 : inexact-ok
> += tan tonearest ibm128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038ep+0 : inexact-ok
> += tan towardzero ibm128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038ep+0 : inexact-ok
> += tan upward ibm128 0xc.2bbe7p+44 : -0x1.f98ad7344f058d2a9d3cb9038ep+0 : inexact-ok
> += tan downward binary64 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61dp+48 : inexact-ok
> += tan tonearest binary64 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61dp+48 : inexact-ok
> += tan towardzero binary64 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61dp+48 : inexact-ok
> += tan upward binary64 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d8p+48 : inexact-ok
> += tan downward intel96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13dp+48 : inexact-ok
> += tan tonearest intel96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13ep+48 : inexact-ok
> += tan towardzero intel96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13dp+48 : inexact-ok
> += tan upward intel96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13ep+48 : inexact-ok
> += tan downward m68k96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13dp+48 : inexact-ok
> += tan tonearest m68k96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13ep+48 : inexact-ok
> += tan towardzero m68k96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13dp+48 : inexact-ok
> += tan upward m68k96 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13ep+48 : inexact-ok
> += tan downward binary128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287e07p+48 : inexact-ok
> += tan tonearest binary128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287e07p+48 : inexact-ok
> += tan towardzero binary128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287e07p+48 : inexact-ok
> += tan upward binary128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287e078p+48 : inexact-ok
> += tan downward ibm128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287ep+48 : inexact-ok
> += tan tonearest ibm128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287ep+48 : inexact-ok
> += tan towardzero ibm128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287ep+48 : inexact-ok
> += tan upward ibm128 0xc.2bbe762a55cp+44 : 0xd.b2bb1feab61d13de3fb08287e4p+48 : inexact-ok
> +tan 0x1.dbd58768f97p+45
> += tan downward binary32 0x3.b7ab1p+44 : 0x6.cb1538p-4 : inexact-ok
> += tan tonearest binary32 0x3.b7ab1p+44 : 0x6.cb1538p-4 : inexact-ok
> += tan towardzero binary32 0x3.b7ab1p+44 : 0x6.cb1538p-4 : inexact-ok
> += tan upward binary32 0x3.b7ab1p+44 : 0x6.cb154p-4 : inexact-ok
> += tan downward binary64 0x3.b7ab1p+44 : 0x6.cb1538f077ba4p-4 : inexact-ok
> += tan tonearest binary64 0x3.b7ab1p+44 : 0x6.cb1538f077ba8p-4 : inexact-ok
> += tan towardzero binary64 0x3.b7ab1p+44 : 0x6.cb1538f077ba4p-4 : inexact-ok
> += tan upward binary64 0x3.b7ab1p+44 : 0x6.cb1538f077ba8p-4 : inexact-ok
> += tan downward intel96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan tonearest intel96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan towardzero intel96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan upward intel96 0x3.b7ab1p+44 : 0x6.cb1538f077ba74ap-4 : inexact-ok
> += tan downward m68k96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan tonearest m68k96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan towardzero m68k96 0x3.b7ab1p+44 : 0x6.cb1538f077ba7498p-4 : inexact-ok
> += tan upward m68k96 0x3.b7ab1p+44 : 0x6.cb1538f077ba74ap-4 : inexact-ok
> += tan downward binary128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191561d4p-4 : inexact-ok
> += tan tonearest binary128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191561d4p-4 : inexact-ok
> += tan towardzero binary128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191561d4p-4 : inexact-ok
> += tan upward binary128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191561d8p-4 : inexact-ok
> += tan downward ibm128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf01719156p-4 : inexact-ok
> += tan tonearest ibm128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191562p-4 : inexact-ok
> += tan towardzero ibm128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf01719156p-4 : inexact-ok
> += tan upward ibm128 0x3.b7ab1p+44 : 0x6.cb1538f077ba749bf017191562p-4 : inexact-ok
> += tan downward binary32 0x3.b7ab0cp+44 : -0x1.62d178p+0 : inexact-ok
> += tan tonearest binary32 0x3.b7ab0cp+44 : -0x1.62d178p+0 : inexact-ok
> += tan towardzero binary32 0x3.b7ab0cp+44 : -0x1.62d176p+0 : inexact-ok
> += tan upward binary32 0x3.b7ab0cp+44 : -0x1.62d176p+0 : inexact-ok
> += tan downward binary64 0x3.b7ab0cp+44 : -0x1.62d177235023fp+0 : inexact-ok
> += tan tonearest binary64 0x3.b7ab0cp+44 : -0x1.62d177235023fp+0 : inexact-ok
> += tan towardzero binary64 0x3.b7ab0cp+44 : -0x1.62d177235023ep+0 : inexact-ok
> += tan upward binary64 0x3.b7ab0cp+44 : -0x1.62d177235023ep+0 : inexact-ok
> += tan downward intel96 0x3.b7ab0cp+44 : -0x1.62d177235023ec84p+0 : inexact-ok
> += tan tonearest intel96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan towardzero intel96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan upward intel96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan downward m68k96 0x3.b7ab0cp+44 : -0x1.62d177235023ec84p+0 : inexact-ok
> += tan tonearest m68k96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan towardzero m68k96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan upward m68k96 0x3.b7ab0cp+44 : -0x1.62d177235023ec82p+0 : inexact-ok
> += tan downward binary128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254005bp+0 : inexact-ok
> += tan tonearest binary128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254005bp+0 : inexact-ok
> += tan towardzero binary128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254005ap+0 : inexact-ok
> += tan upward binary128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254005ap+0 : inexact-ok
> += tan downward ibm128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254008p+0 : inexact-ok
> += tan tonearest ibm128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254008p+0 : inexact-ok
> += tan towardzero ibm128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254p+0 : inexact-ok
> += tan upward ibm128 0x3.b7ab0cp+44 : -0x1.62d177235023ec820b6bd254p+0 : inexact-ok
> += tan downward binary64 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207cap+44 : inexact-ok
> += tan tonearest binary64 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ep+44 : inexact-ok
> += tan towardzero binary64 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ep+44 : inexact-ok
> += tan upward binary64 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ep+44 : inexact-ok
> += tan downward intel96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea7p+44 : inexact-ok
> += tan tonearest intel96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea7p+44 : inexact-ok
> += tan towardzero intel96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6cp+44 : inexact-ok
> += tan upward intel96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6cp+44 : inexact-ok
> += tan downward m68k96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea7p+44 : inexact-ok
> += tan tonearest m68k96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea7p+44 : inexact-ok
> += tan towardzero m68k96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6cp+44 : inexact-ok
> += tan upward m68k96 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6cp+44 : inexact-ok
> += tan downward binary128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064ae78p+44 : inexact-ok
> += tan tonearest binary128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064ae76p+44 : inexact-ok
> += tan towardzero binary128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064ae76p+44 : inexact-ok
> += tan upward binary128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064ae76p+44 : inexact-ok
> += tan downward ibm128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064afp+44 : inexact-ok
> += tan tonearest ibm128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064aep+44 : inexact-ok
> += tan towardzero ibm128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064aep+44 : inexact-ok
> += tan upward ibm128 0x3.b7ab0ed1f2ep+44 : -0x3.e527dfc207c9ea6ef715e064aep+44 : inexact-ok
>   tan max
>   = tan downward binary32 0xf.fffffp+124 : -0x9.c9ecbp-4 : inexact-ok
>   = tan tonearest binary32 0xf.fffffp+124 : -0x9.c9ecap-4 : inexact-ok
> diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
> index 3865dcf905c..34161cc2f66 100644
> --- a/sysdeps/generic/math_private.h
> +++ b/sysdeps/generic/math_private.h
> @@ -198,6 +198,5 @@ do {								\
>   /* Prototypes for functions of the IBM Accurate Mathematical Library.  */
>   extern double __sin (double __x);
>   extern double __cos (double __x);
> -extern int __branred (double __x, double *__a, double *__aa);
>   
>   #endif /* _MATH_PRIVATE_H_ */
> diff --git a/sysdeps/ieee754/dbl-64/Makefile b/sysdeps/ieee754/dbl-64/Makefile
> index ac2e2ecc5ea..f9f71b7b6f1 100644
> --- a/sysdeps/ieee754/dbl-64/Makefile
> +++ b/sysdeps/ieee754/dbl-64/Makefile
> @@ -1,6 +1,4 @@
>   ifeq ($(subdir),math)
> -# branred depends on precise IEEE double rounding
> -CFLAGS-branred.c += $(config-cflags-nofma)
>   CFLAGS-e_sqrt.c += $(config-cflags-nofma)
>   
>   # The symbols alias to lround
> diff --git a/sysdeps/ieee754/dbl-64/branred.c b/sysdeps/ieee754/dbl-64/branred.c
> deleted file mode 100644
> index d78c013d5a8..00000000000
> --- a/sysdeps/ieee754/dbl-64/branred.c
> +++ /dev/null
> @@ -1,143 +0,0 @@
> -/*
> - * IBM Accurate Mathematical Library
> - * Copyright (C) 2001-2026 Free Software Foundation, Inc.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU Lesser General Public License as published by
> - * the Free Software Foundation; either version 2.1 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public License
> - * along with this program; if not, see <https://www.gnu.org/licenses/>.
> - */
> -/*******************************************************************/
> -/*                                                                 */
> -/* MODULE_NAME: branred.c                                          */
> -/*                                                                 */
> -/* FUNCTIONS:   branred                                            */
> -/*                                                                 */
> -/* FILES NEEDED: branred.h mydefs.h endian.h mpa.h                 */
> -/*               mha.c                                             */
> -/*                                                                 */
> -/* Routine  branred() performs range  reduction of a double number */
> -/* x into Double length number  a+aa,such that                     */
> -/* x=n*pi/2+(a+aa), abs(a+aa)<pi/4, n=0,+-1,+-2,....               */
> -/* Routine returns the integer (n mod 4) of the above description  */
> -/* of x.                                                           */
> -/*******************************************************************/
> -
> -#include "endian.h"
> -#include "mydefs.h"
> -#include "branred.h"
> -#include <math.h>
> -#include <math_private.h>
> -
> -#ifndef SECTION
> -# define SECTION
> -#endif
> -
> -
> -/*******************************************************************/
> -/* Routine  branred() performs range  reduction of a double number */
> -/* x into Double length number a+aa,such that                      */
> -/* x=n*pi/2+(a+aa), abs(a+aa)<pi/4, n=0,+-1,+-2,....               */
> -/* Routine return integer (n mod 4)                                */
> -/*******************************************************************/
> -int
> -SECTION
> -__branred(double x, double *a, double *aa)
> -{
> -  int i,k;
> -  mynumber  u,gor;
> -  double r[6],s,t,sum,b,bb,sum1,sum2,b1,bb1,b2,bb2,x1,x2,t1,t2;
> -
> -  x*=tm600.x;
> -  t=x*split;   /* split x to two numbers */
> -  x1=t-(t-x);
> -  x2=x-x1;
> -  sum=0;
> -  u.x = x1;
> -  k = (u.i[HIGH_HALF]>>20)&2047;
> -  k = (k-450)/24;
> -  if (k<0)
> -    k=0;
> -  gor.x = t576.x;
> -  gor.i[HIGH_HALF] -= ((k*24)<<20);
> -  for (i=0;i<6;i++)
> -    { r[i] = x1*toverp[k+i]*gor.x; gor.x *= tm24.x; }
> -  for (i=0;i<3;i++) {
> -    s=(r[i]+big.x)-big.x;
> -    sum+=s;
> -    r[i]-=s;
> -  }
> -  t=0;
> -  for (i=0;i<6;i++)
> -    t+=r[5-i];
> -  bb=(((((r[0]-t)+r[1])+r[2])+r[3])+r[4])+r[5];
> -  s=(t+big.x)-big.x;
> -  sum+=s;
> -  t-=s;
> -  b=t+bb;
> -  bb=(t-b)+bb;
> -  s=(sum+big1.x)-big1.x;
> -  sum-=s;
> -  b1=b;
> -  bb1=bb;
> -  sum1=sum;
> -  sum=0;
> -
> -  u.x = x2;
> -  k = (u.i[HIGH_HALF]>>20)&2047;
> -  k = (k-450)/24;
> -  if (k<0)
> -    k=0;
> -  gor.x = t576.x;
> -  gor.i[HIGH_HALF] -= ((k*24)<<20);
> -  for (i=0;i<6;i++)
> -    { r[i] = x2*toverp[k+i]*gor.x; gor.x *= tm24.x; }
> -  for (i=0;i<3;i++) {
> -    s=(r[i]+big.x)-big.x;
> -    sum+=s;
> -    r[i]-=s;
> -  }
> -  t=0;
> -  for (i=0;i<6;i++)
> -    t+=r[5-i];
> -  bb=(((((r[0]-t)+r[1])+r[2])+r[3])+r[4])+r[5];
> -  s=(t+big.x)-big.x;
> - sum+=s;
> - t-=s;
> - b=t+bb;
> - bb=(t-b)+bb;
> - s=(sum+big1.x)-big1.x;
> - sum-=s;
> -
> - b2=b;
> - bb2=bb;
> - sum2=sum;
> -
> - sum=sum1+sum2;
> - b=b1+b2;
> - bb = (fabs(b1)>fabs(b2))? (b1-b)+b2 : (b2-b)+b1;
> - if (b > 0.5)
> -   {b-=1.0; sum+=1.0;}
> - else if (b < -0.5)
> -   {b+=1.0; sum-=1.0;}
> - s=b+(bb+bb1+bb2);
> - t=((b-s)+bb)+(bb1+bb2);
> - b=s*split;
> - t1=b-(b-s);
> - t2=s-t1;
> - b=s*hp0.x;
> - bb=(((t1*mp1.x-b)+t1*mp2.x)+t2*mp1.x)+(t2*mp2.x+s*hp1.x+t*hp0.x);
> - s=b+bb;
> - t=(b-s)+bb;
> - *a=s;
> - *aa=t;
> - return ((int) sum)&3; /* return quarter of unit circle */
> -}
> diff --git a/sysdeps/ieee754/dbl-64/branred.h b/sysdeps/ieee754/dbl-64/branred.h
> deleted file mode 100644
> index d34914d9c39..00000000000
> --- a/sysdeps/ieee754/dbl-64/branred.h
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -/*
> - * IBM Accurate Mathematical Library
> - * Copyright (C) 2001-2026 Free Software Foundation, Inc.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU Lesser General Public License as published by
> - * the Free Software Foundation; either version 2.1 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public License
> - * along with this program; if not, see <https://www.gnu.org/licenses/>.
> - */
> -/************************************************************************/
> -/*  MODULE_NAME: branred.h                                              */
> -/*                                                                      */
> -/*                                                                      */
> -/* 	common data and variables definition for BIG or LITTLE ENDIAN   */
> -/************************************************************************/
> -
> -#ifndef BRANRED_H
> -#define BRANRED_H
> -
> -#include <dla.h>
> -
> -#ifdef BIG_ENDI
> -static const mynumber
> -
> -/**/           t576 = {{0x63f00000, 0x00000000}}, /* 2 ^ 576  */
> -/**/          tm600 = {{0x1a700000, 0x00000000}}, /* 2 ^- 600 */
> -/**/           tm24 = {{0x3e700000, 0x00000000}}, /* 2 ^- 24  */
> -/**/            big = {{0x43380000, 0x00000000}}, /*  6755399441055744      */
> -/**/           big1 = {{0x43580000, 0x00000000}}, /* 27021597764222976      */
> -/**/            hp0 = {{0x3FF921FB, 0x54442D18}} ,/* 1.5707963267948966     */
> -/**/            hp1 = {{0x3C91A626, 0x33145C07}} ,/* 6.123233995736766e-17  */
> -/**/            mp1 = {{0x3FF921FB, 0x58000000}}, /* 1.5707963407039642     */
> -/**/            mp2 = {{0xBE4DDE97, 0x40000000}}; /*-1.3909067675399456e-08 */
> -
> -#else
> -#ifdef LITTLE_ENDI
> -static const mynumber
> -
> -/**/           t576 = {{0x00000000, 0x63f00000}},  /* 2 ^ 576  */
> -/**/          tm600 = {{0x00000000, 0x1a700000}},  /* 2 ^- 600 */
> -/**/           tm24 = {{0x00000000, 0x3e700000}},  /* 2 ^- 24  */
> -/**/            big = {{0x00000000, 0x43380000}},  /*  6755399441055744      */
> -/**/           big1 = {{0x00000000, 0x43580000}},  /* 27021597764222976      */
> -/**/            hp0 = {{0x54442D18, 0x3FF921FB}},  /* 1.5707963267948966     */
> -/**/            hp1 = {{0x33145C07, 0x3C91A626}},  /* 6.123233995736766e-17  */
> -/**/            mp1 = {{0x58000000, 0x3FF921FB}},  /* 1.5707963407039642     */
> -/**/            mp2 = {{0x40000000, 0xBE4DDE97}};  /*-1.3909067675399456e-08 */
> -
> -#endif
> -#endif
> -
> -static const double toverp[75] = { /*  2/ PI base 24*/
> -  10680707.0,  7228996.0,  1387004.0,  2578385.0, 16069853.0,
> -  12639074.0,  9804092.0,  4427841.0, 16666979.0, 11263675.0,
> -  12935607.0,  2387514.0,  4345298.0, 14681673.0,  3074569.0,
> -  13734428.0, 16653803.0,  1880361.0, 10960616.0,  8533493.0,
> -   3062596.0,  8710556.0,  7349940.0,  6258241.0,  3772886.0,
> -   3769171.0,  3798172.0,  8675211.0, 12450088.0,  3874808.0,
> -   9961438.0,   366607.0, 15675153.0,  9132554.0,  7151469.0,
> -   3571407.0,  2607881.0, 12013382.0,  4155038.0,  6285869.0,
> -   7677882.0, 13102053.0, 15825725.0,   473591.0,  9065106.0,
> -  15363067.0,  6271263.0,  9264392.0,  5636912.0,  4652155.0,
> -   7056368.0, 13614112.0, 10155062.0,  1944035.0,  9527646.0,
> -  15080200.0,  6658437.0,  6231200.0,  6832269.0, 16767104.0,
> -   5075751.0,  3212806.0,  1398474.0,  7579849.0,  6349435.0,
> -  12618859.0,  4703257.0, 12806093.0, 14477321.0,  2786137.0,
> -  12875403.0,  9837734.0, 14528324.0, 13719321.0,   343717.0 };
> -
> -static const double split =  CN;	/* 2^27 + 1 */
> -
> -#endif
> diff --git a/sysdeps/ieee754/dbl-64/e_rem_pio2.c b/sysdeps/ieee754/dbl-64/e_rem_pio2.c
> new file mode 100644
> index 00000000000..9e910e69995
> --- /dev/null
> +++ b/sysdeps/ieee754/dbl-64/e_rem_pio2.c
> @@ -0,0 +1,76 @@
> +/*
> + * ====================================================
> + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> + *
> + * Developed at SunPro, a Sun Microsystems, Inc. business.
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * ====================================================
> + */
> +
> +/* __ieee754_rem_pio2(x,y)
> + *
> + * return the remainder of x rem pi/2 in y[0]+y[1]
> + * use __kernel_rem_pio2()
> + *
> + * The callers (sin, cos, sincos, and tan) reduce smaller arguments
> + * themselves and handle non-finite inputs, so only the huge-argument
> + * path of the original fdlibm routine is kept: the caller guarantees
> + * 1e8 < |x| < 2^1024.
> + */
> +
> +#include <math.h>
> +#include <math_private.h>
> +
> +/*
> + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
> + */
> +static const int32_t two_over_pi[] = {
> +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
> +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
> +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
> +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
> +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
> +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
> +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
> +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
> +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
> +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
> +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
> +};
> +
> +static const double
> +  zero    = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
> +  two24   = 1.67772160000000000000e+07; /* 0x41700000, 0x00000000 */
> +
> +int32_t
> +__ieee754_rem_pio2 (double x, double *y)
> +{
> +  double z;
> +  double tx[3];
> +  int32_t e0, i, nx, n, ix, hx;
> +  uint32_t low;
> +
> +  GET_HIGH_WORD (hx, x);                /* high word of x */
> +  ix = hx & 0x7fffffff;
> +  /* set z = scalbn(|x|,ilogb(x)-23) */
> +  GET_LOW_WORD (low, x);
> +  e0 = (ix >> 20) - 1046;               /* e0 = ilogb(z)-23; */
> +  INSERT_WORDS (z, ix - ((int32_t) (e0 << 20)), low);
> +  for (i = 0; i < 2; i++)
> +    {
> +      tx[i] = (double) ((int32_t) (z));
> +      z = (z - tx[i]) * two24;
> +    }
> +  tx[2] = z;
> +  nx = 3;
> +  while (tx[nx - 1] == zero)
> +    nx--;                               /* skip zero term */
> +  n = __kernel_rem_pio2 (tx, y, e0, nx, 2, two_over_pi);
> +  if (hx < 0)
> +    {
> +      y[0] = -y[0]; y[1] = -y[1]; return -n;
> +    }
> +  return n;
> +}
> diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
> index 272d560c3e6..4fe289bdd23 100644
> --- a/sysdeps/ieee754/dbl-64/s_sin.c
> +++ b/sysdeps/ieee754/dbl-64/s_sin.c
> @@ -23,7 +23,7 @@
>   /* FUNCTIONS: usin                                                          */
>   /*            ucos                                                          */
>   /* FILES NEEDED: dla.h endian.h mpa.h mydefs.h  usncs.h                     */
> -/*		 branred.c sincos.tbl					    */
> +/*		 e_rem_pio2.c sincos.tbl				    */
>   /*                                                                          */
>   /* An ultimate sin and cos routine. Given an IEEE double machine number x   */
>   /* it computes sin(x) or cos(x) with ~0.55 ULP.				    */
> @@ -90,8 +90,6 @@ static const double
>     cs4 = -4.16666666666664434524222570944589E-02,
>     cs6 = 1.38888874007937613028114285595617E-03;
>   
> -int __branred (double x, double *a, double *aa);
> -
>   /* Given a number partitioned into X and DX, this function computes the cosine
>      of the number by combining the sin and cos of X (as computed by a variation
>      of the Taylor series) with the values looked up from the sin/cos table to
> @@ -239,8 +237,9 @@ __sin (double x)
>   /* --------------------105414350 <|x| <2^1024------------------------------*/
>     else if (k < 0x7ff00000)
>       {
> -      n = __branred (x, &a, &da);
> -      retval = do_sincos (a, da, n);
> +      double y[2];
> +      n = __ieee754_rem_pio2 (x, y);
> +      retval = do_sincos (y[0], y[1], n);
>       }
>   /*--------------------- |x| > 2^1024 ----------------------------------*/
>     else
> @@ -304,8 +303,9 @@ __cos (double x)
>     /* 105414350 <|x| <2^1024 */
>     else if (k < 0x7ff00000)
>       {
> -      n = __branred (x, &a, &da);
> -      retval = do_sincos (a, da, n + 1);
> +      double y[2];
> +      n = __ieee754_rem_pio2 (x, y);
> +      retval = do_sincos (y[0], y[1], n + 1);
>       }
>   
>     else
> diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
> index 17f795fc14e..501031dc378 100644
> --- a/sysdeps/ieee754/dbl-64/s_sincos.c
> +++ b/sysdeps/ieee754/dbl-64/s_sincos.c
> @@ -78,7 +78,15 @@ __sincos (double x, double *sinx, double *cosx)
>         unsigned int n;
>   
>         /* If |x| < 105414350 use simple range reduction.  */
> -      n = k < 0x419921FB ? reduce_sincos (x, &a, &da) : __branred (x, &a, &da);
> +      if (k < 0x419921FB)
> +	n = reduce_sincos (x, &a, &da);
> +      else
> +	{
> +	  double y[2];

OK. Threshold for x is x < 1.05e8 (within 1e8).

> +	  n = __ieee754_rem_pio2 (x, y);
> +	  a = y[0];
> +	  da = y[1];
> +	}
>         n = n & 3;
>   
>         if (n == 1 || n == 2)
> diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c
> index 6568b1cd3c5..bb949110ad0 100644
> --- a/sysdeps/ieee754/dbl-64/s_tan.c
> +++ b/sysdeps/ieee754/dbl-64/s_tan.c
> @@ -22,7 +22,7 @@
>   /*  FUNCTIONS: utan                                                  */
>   /*                                                                   */
>   /*  FILES NEEDED:dla.h endian.h mydefs.h utan.h                      */
> -/*               branred.c                                           */
> +/*               e_rem_pio2.c                                        */
>   /*               utan.tbl                                            */
>   /*                                                                   */
>   /*********************************************************************/
> @@ -59,8 +59,6 @@ __tan (double x)
>   
>     double retval;
>   
> -  int __branred (double, double *, double *);
> -
>     SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
>   
>     /* x=+-INF, x=NaN */
> @@ -293,8 +291,11 @@ __tan (double x)
>   
>     /* (---) The case 1e8 < abs(x) < 2**1024 */
>     /* Range reduction by algorithm iii */
> -  n = (__branred (x, &a, &da)) & 0x00000001;
> -  EADD (a, da, t1, t2);
> +  {
> +    double y[2];
> +    n = __ieee754_rem_pio2 (x, y) & 0x00000001;
> +    EADD (y[0], y[1], t1, t2);
> +  }
>     a = t1;
>     da = t2;
>     if (a < 0.0)
> diff --git a/sysdeps/m68k/m680x0/fpu/e_rem_pio2.c b/sysdeps/m68k/m680x0/fpu/e_rem_pio2.c
> new file mode 100644
> index 00000000000..6e25b021ab5
> --- /dev/null
> +++ b/sysdeps/m68k/m680x0/fpu/e_rem_pio2.c
> @@ -0,0 +1 @@
> +/* Empty.  */
> diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> index 8af53b30758..5ad28fc5fc1 100644
> --- a/sysdeps/x86_64/fpu/Makefile
> +++ b/sysdeps/x86_64/fpu/Makefile
> @@ -67,18 +67,6 @@ CFLAGS-test-double-vlen4-avx2-wrappers.c = $(double-vlen4-arch-ext2-cflags)
>   CFLAGS-test-float-vlen8-avx2-wrappers.c = $(float-vlen8-arch-ext2-cflags)
>   endif
>   
> -ifeq ($(subdir)$(config-cflags-mprefer-vector-width),mathyes)
> -# When compiled with -O3 -march=skylake, GCC 8 and 9 optimize some loops
> -# in branred.c with 256-bit vector instructions, which leads to store
> -# forward stall:
> -#
> -# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90579
> -#
> -# Limit vector width to 128 bits to work around this issue.  It improves
> -# performance of sin and cos by more than 40% on Skylake.
> -CFLAGS-branred.c = -mprefer-vector-width=128
> -endif
> -

OK. Not required.

>   ifeq ($(subdir)$(build-mathvec),benchtestsyes)
>   double-vlen4-arch-ext-cflags = -mavx
>   double-vlen4-arch-ext2-cflags = -mavx2


-- 
Cheers,
Carlos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.