diff mbox series

[v2] math: Add more input to atanh accuracy tests

Message ID 20220224000423.13804-1-skpgkp2@gmail.com
State New
Headers show
Series [v2] math: Add more input to atanh accuracy tests | expand

Commit Message

Sunil Pandey Feb. 24, 2022, 12:04 a.m. UTC
This patch adds following input to atanh accuracy test.

    0x1.f80094p-8

Tested on x86-64 and i686 platforms.
Other platforms may have to regenerate ulps file.
---
 math/auto-libm-test-in        |  3 +++
 math/auto-libm-test-out-atanh | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

Comments

Paul Zimmermann Feb. 24, 2022, 9:37 a.m. UTC | #1
Dear Sunil,

I cannot reproduce the error of 2.4 ulps with 0x1.f80094p-8, the maximal
error I get is 1.45 ulps (with master revision b98d0bb):

pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
LIBMVEC=512 -mavx512f
00000000004148f0 T mpfr_atanh
0000000000401668 t mpfr_atanh.cold
                 U _ZGVeN16v_atanhf@GLIBC_2.35
Checking atanh with libmvec from glibc and rndn
Thu 24 Feb 2022 10:28:21 AM CET
MPFR library: 4.1.0       
MPFR header:  4.1.0 (based on 4.1.0)
Checking function atanhf with MPFR_RNDN
libm wrong by up to 1.45e+00 ulp(s) [1] for x=0x1.f2100ap-9
atanh      gives 0x1.f210aap-9
mpfr_atanh gives 0x1.f210a8p-9
Total: errors=58600734 (1.37%) errors2=0 maxerr=1.45e+00 ulp(s)

Best regards,
Paul

> Date: Wed, 23 Feb 2022 16:04:23 -0800
> From: Sunil K Pandey via Libc-alpha <libc-alpha@sourceware.org>
> 
> This patch adds following input to atanh accuracy test.
> 
>     0x1.f80094p-8
> 
> Tested on x86-64 and i686 platforms.
> Other platforms may have to regenerate ulps file.
> ---
>  math/auto-libm-test-in        |  3 +++
>  math/auto-libm-test-out-atanh | 25 +++++++++++++++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> index 9080afe4fb..30fbada31f 100644
> --- a/math/auto-libm-test-in
> +++ b/math/auto-libm-test-in
> @@ -617,6 +617,9 @@ atanh -0x3.98eaf4p-4
>  atanh 0x2.c1085p-4
>  atanh 0x1p-500
>  atanh 0x1p-5000
> +# the next value generates larger error bounds in libmvec/avx512 on x86_64
> +# (binary32)
> +atanh 0x1.f80094p-8
>  # the next value generates larger error bounds on x86_64 (binary128)
>  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
>  atanh min
> diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh
> index 378ef6e8cf..a5243264be 100644
> --- a/math/auto-libm-test-out-atanh
> +++ b/math/auto-libm-test-out-atanh
> @@ -3112,6 +3112,31 @@ atanh 0x1p-5000
>  = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
>  = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
>  = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok
> +atanh 0x1.f80094p-8
> += atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> += atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> += atanh towardzero binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> += atanh upward binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> += atanh downward binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> += atanh tonearest binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> += atanh towardzero binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> += atanh upward binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> += atanh downward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh tonearest intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh towardzero intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh upward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> += atanh downward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh tonearest m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh towardzero m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> += atanh upward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> += atanh downward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> += atanh tonearest binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> += atanh towardzero binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> += atanh upward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> += atanh downward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> += atanh tonearest ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> += atanh towardzero ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> += atanh upward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d3p-8 : inexact-ok
>  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
>  = atanh downward binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
>  = atanh tonearest binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> -- 
> 2.34.1
>
Sunil Pandey Feb. 24, 2022, 3:57 p.m. UTC | #2
On Thu, Feb 24, 2022 at 1:37 AM Paul Zimmermann
<Paul.Zimmermann@inria.fr> wrote:
>
>        Dear Sunil,
>
> I cannot reproduce the error of 2.4 ulps with 0x1.f80094p-8, the maximal
> error I get is 1.45 ulps (with master revision b98d0bb):
>
Hi Paul,

Please try this one line patch on glibc master. In our testing, before
this patch accuracy for input 0x1.f80094p-8 was ~1.4, after this patch
accuracy for input 0x1.f80094p-8 jumps to 2.4 and it fails. None of
the existing inputs catch this accuracy error jump.

commit c55a882ac9fbe9241cd0537affdbdb35a7a4b6e4 (HEAD ->
users/goldsteinn/atanhf-testable,
origin/users/goldsteinn/atanhf-testable)
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Mon Jan 31 23:00:28 2022 -0600

    Does this have any bugs

diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
index f863f4f959..064424b977 100644
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
@@ -148,7 +148,7 @@ ENTRY(_ZGVeN16v_atanhf_skx)
         vfmadd213ps {rn-sae}, %zmm5, %zmm3, %zmm1
         vmovups   poly_coeff2+__svml_satanh_data_internal_avx512(%rip), %zmm3
         vmovaps   %zmm3, %zmm2
-        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
+//        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
         vfmadd231ps {rn-sae}, %zmm4, %zmm7, %zmm3
         vfmadd213ps {rn-sae}, %zmm12, %zmm9, %zmm2
         vfmadd213ps {rn-sae}, %zmm12, %zmm4, %zmm3

Thanks,
Sunil

> pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
> LIBMVEC=512 -mavx512f
> 00000000004148f0 T mpfr_atanh
> 0000000000401668 t mpfr_atanh.cold
>                  U _ZGVeN16v_atanhf@GLIBC_2.35
> Checking atanh with libmvec from glibc and rndn
> Thu 24 Feb 2022 10:28:21 AM CET
> MPFR library: 4.1.0
> MPFR header:  4.1.0 (based on 4.1.0)
> Checking function atanhf with MPFR_RNDN
> libm wrong by up to 1.45e+00 ulp(s) [1] for x=0x1.f2100ap-9
> atanh      gives 0x1.f210aap-9
> mpfr_atanh gives 0x1.f210a8p-9
> Total: errors=58600734 (1.37%) errors2=0 maxerr=1.45e+00 ulp(s)
>
> Best regards,
> Paul
>
> > Date: Wed, 23 Feb 2022 16:04:23 -0800
> > From: Sunil K Pandey via Libc-alpha <libc-alpha@sourceware.org>
> >
> > This patch adds following input to atanh accuracy test.
> >
> >     0x1.f80094p-8
> >
> > Tested on x86-64 and i686 platforms.
> > Other platforms may have to regenerate ulps file.
> > ---
> >  math/auto-libm-test-in        |  3 +++
> >  math/auto-libm-test-out-atanh | 25 +++++++++++++++++++++++++
> >  2 files changed, 28 insertions(+)
> >
> > diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> > index 9080afe4fb..30fbada31f 100644
> > --- a/math/auto-libm-test-in
> > +++ b/math/auto-libm-test-in
> > @@ -617,6 +617,9 @@ atanh -0x3.98eaf4p-4
> >  atanh 0x2.c1085p-4
> >  atanh 0x1p-500
> >  atanh 0x1p-5000
> > +# the next value generates larger error bounds in libmvec/avx512 on x86_64
> > +# (binary32)
> > +atanh 0x1.f80094p-8
> >  # the next value generates larger error bounds on x86_64 (binary128)
> >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> >  atanh min
> > diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh
> > index 378ef6e8cf..a5243264be 100644
> > --- a/math/auto-libm-test-out-atanh
> > +++ b/math/auto-libm-test-out-atanh
> > @@ -3112,6 +3112,31 @@ atanh 0x1p-5000
> >  = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> >  = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> >  = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok
> > +atanh 0x1.f80094p-8
> > += atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > += atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > += atanh towardzero binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > += atanh upward binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > += atanh downward binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > += atanh tonearest binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > += atanh towardzero binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > += atanh upward binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > += atanh downward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh tonearest intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh towardzero intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh upward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > += atanh downward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh tonearest m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh towardzero m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > += atanh upward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > += atanh downward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > += atanh tonearest binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > += atanh towardzero binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > += atanh upward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > += atanh downward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > += atanh tonearest ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > += atanh towardzero ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > += atanh upward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d3p-8 : inexact-ok
> >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> >  = atanh downward binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> >  = atanh tonearest binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> > --
> > 2.34.1
> >
Paul Zimmermann Feb. 24, 2022, 4:13 p.m. UTC | #3
Dear Sunil,

I confirm:

pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
LIBMVEC=512 -mavx512f
00000000004148f0 T mpfr_atanh
0000000000401668 t mpfr_atanh.cold
                 U _ZGVeN16v_atanhf@GLIBC_2.35
Checking atanh with libmvec from glibc and rndn
Thu 24 Feb 2022 05:07:33 PM CET
MPFR library: 4.1.0       
MPFR header:  4.1.0 (based on 4.1.0)
Checking function atanhf with MPFR_RNDN
libm wrong by up to 2.41e+00 ulp(s) [2] for x=0x1.f80094p-8
atanh      gives 0x1.f80324p-8
mpfr_atanh gives 0x1.f8032p-8
Total: errors=63814706 (1.49%) errors2=317192 maxerr=2.41e+00 ulp(s)

then maybe the auto-libm-test-in change should be included in the patch
to svml_s_atanhf16_core_avx512.S if you plan to submit it?

Best regards,
Paul

> From: Sunil Pandey <skpgkp2@gmail.com>
> Date: Thu, 24 Feb 2022 07:57:03 -0800
> Cc: GNU C Library <libc-alpha@sourceware.org>
> 
> On Thu, Feb 24, 2022 at 1:37 AM Paul Zimmermann
> <Paul.Zimmermann@inria.fr> wrote:
> >
> >        Dear Sunil,
> >
> > I cannot reproduce the error of 2.4 ulps with 0x1.f80094p-8, the maximal
> > error I get is 1.45 ulps (with master revision b98d0bb):
> >
> Hi Paul,
> 
> Please try this one line patch on glibc master. In our testing, before
> this patch accuracy for input 0x1.f80094p-8 was ~1.4, after this patch
> accuracy for input 0x1.f80094p-8 jumps to 2.4 and it fails. None of
> the existing inputs catch this accuracy error jump.
> 
> commit c55a882ac9fbe9241cd0537affdbdb35a7a4b6e4 (HEAD ->
> users/goldsteinn/atanhf-testable,
> origin/users/goldsteinn/atanhf-testable)
> Author: Noah Goldstein <goldstein.w.n@gmail.com>
> Date:   Mon Jan 31 23:00:28 2022 -0600
> 
>     Does this have any bugs
> 
> diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> index f863f4f959..064424b977 100644
> --- a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> +++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> @@ -148,7 +148,7 @@ ENTRY(_ZGVeN16v_atanhf_skx)
>          vfmadd213ps {rn-sae}, %zmm5, %zmm3, %zmm1
>          vmovups   poly_coeff2+__svml_satanh_data_internal_avx512(%rip), %zmm3
>          vmovaps   %zmm3, %zmm2
> -        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
> +//        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
>          vfmadd231ps {rn-sae}, %zmm4, %zmm7, %zmm3
>          vfmadd213ps {rn-sae}, %zmm12, %zmm9, %zmm2
>          vfmadd213ps {rn-sae}, %zmm12, %zmm4, %zmm3
> 
> Thanks,
> Sunil
> 
> > pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
> > LIBMVEC=512 -mavx512f
> > 00000000004148f0 T mpfr_atanh
> > 0000000000401668 t mpfr_atanh.cold
> >                  U _ZGVeN16v_atanhf@GLIBC_2.35
> > Checking atanh with libmvec from glibc and rndn
> > Thu 24 Feb 2022 10:28:21 AM CET
> > MPFR library: 4.1.0
> > MPFR header:  4.1.0 (based on 4.1.0)
> > Checking function atanhf with MPFR_RNDN
> > libm wrong by up to 1.45e+00 ulp(s) [1] for x=0x1.f2100ap-9
> > atanh      gives 0x1.f210aap-9
> > mpfr_atanh gives 0x1.f210a8p-9
> > Total: errors=58600734 (1.37%) errors2=0 maxerr=1.45e+00 ulp(s)
> >
> > Best regards,
> > Paul
> >
> > > Date: Wed, 23 Feb 2022 16:04:23 -0800
> > > From: Sunil K Pandey via Libc-alpha <libc-alpha@sourceware.org>
> > >
> > > This patch adds following input to atanh accuracy test.
> > >
> > >     0x1.f80094p-8
> > >
> > > Tested on x86-64 and i686 platforms.
> > > Other platforms may have to regenerate ulps file.
> > > ---
> > >  math/auto-libm-test-in        |  3 +++
> > >  math/auto-libm-test-out-atanh | 25 +++++++++++++++++++++++++
> > >  2 files changed, 28 insertions(+)
> > >
> > > diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> > > index 9080afe4fb..30fbada31f 100644
> > > --- a/math/auto-libm-test-in
> > > +++ b/math/auto-libm-test-in
> > > @@ -617,6 +617,9 @@ atanh -0x3.98eaf4p-4
> > >  atanh 0x2.c1085p-4
> > >  atanh 0x1p-500
> > >  atanh 0x1p-5000
> > > +# the next value generates larger error bounds in libmvec/avx512 on x86_64
> > > +# (binary32)
> > > +atanh 0x1.f80094p-8
> > >  # the next value generates larger error bounds on x86_64 (binary128)
> > >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> > >  atanh min
> > > diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh
> > > index 378ef6e8cf..a5243264be 100644
> > > --- a/math/auto-libm-test-out-atanh
> > > +++ b/math/auto-libm-test-out-atanh
> > > @@ -3112,6 +3112,31 @@ atanh 0x1p-5000
> > >  = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> > >  = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> > >  = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok
> > > +atanh 0x1.f80094p-8
> > > += atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > > += atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > > += atanh towardzero binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > > += atanh upward binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > > += atanh downward binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > > += atanh tonearest binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > > += atanh towardzero binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > > += atanh upward binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > > += atanh downward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh tonearest intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh towardzero intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh upward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > > += atanh downward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh tonearest m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh towardzero m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > += atanh upward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > > += atanh downward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > > += atanh tonearest binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > > += atanh towardzero binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > > += atanh upward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > > += atanh downward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > += atanh tonearest ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > += atanh towardzero ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > += atanh upward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d3p-8 : inexact-ok
> > >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> > >  = atanh downward binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> > >  = atanh tonearest binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> > > --
> > > 2.34.1
> > >
Sunil Pandey Feb. 24, 2022, 4:31 p.m. UTC | #4
On Thu, Feb 24, 2022 at 8:13 AM Paul Zimmermann
<Paul.Zimmermann@inria.fr> wrote:
>
>        Dear Sunil,
>
> I confirm:
>
> pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
> LIBMVEC=512 -mavx512f
> 00000000004148f0 T mpfr_atanh
> 0000000000401668 t mpfr_atanh.cold
>                  U _ZGVeN16v_atanhf@GLIBC_2.35
> Checking atanh with libmvec from glibc and rndn
> Thu 24 Feb 2022 05:07:33 PM CET
> MPFR library: 4.1.0
> MPFR header:  4.1.0 (based on 4.1.0)
> Checking function atanhf with MPFR_RNDN
> libm wrong by up to 2.41e+00 ulp(s) [2] for x=0x1.f80094p-8
> atanh      gives 0x1.f80324p-8
> mpfr_atanh gives 0x1.f8032p-8
> Total: errors=63814706 (1.49%) errors2=317192 maxerr=2.41e+00 ulp(s)
>
> then maybe the auto-libm-test-in change should be included in the patch
> to svml_s_atanhf16_core_avx512.S if you plan to submit it?
>

Hi Paul,

    I do not plan this patch(svml_s_atanhf16_core_avx512.S) to be
submitted, but I want this
    input(0x1.f80094p-8) to be included in auto-libm-test-in, as it
can help as a checkguard for
    changes like this in future.

Thanks,
Sunil

> Best regards,
> Paul
>
> > From: Sunil Pandey <skpgkp2@gmail.com>
> > Date: Thu, 24 Feb 2022 07:57:03 -0800
> > Cc: GNU C Library <libc-alpha@sourceware.org>
> >
> > On Thu, Feb 24, 2022 at 1:37 AM Paul Zimmermann
> > <Paul.Zimmermann@inria.fr> wrote:
> > >
> > >        Dear Sunil,
> > >
> > > I cannot reproduce the error of 2.4 ulps with 0x1.f80094p-8, the maximal
> > > error I get is 1.45 ulps (with master revision b98d0bb):
> > >
> > Hi Paul,
> >
> > Please try this one line patch on glibc master. In our testing, before
> > this patch accuracy for input 0x1.f80094p-8 was ~1.4, after this patch
> > accuracy for input 0x1.f80094p-8 jumps to 2.4 and it fails. None of
> > the existing inputs catch this accuracy error jump.
> >
> > commit c55a882ac9fbe9241cd0537affdbdb35a7a4b6e4 (HEAD ->
> > users/goldsteinn/atanhf-testable,
> > origin/users/goldsteinn/atanhf-testable)
> > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > Date:   Mon Jan 31 23:00:28 2022 -0600
> >
> >     Does this have any bugs
> >
> > diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> > b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> > index f863f4f959..064424b977 100644
> > --- a/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> > +++ b/sysdeps/x86_64/fpu/multiarch/svml_s_atanhf16_core_avx512.S
> > @@ -148,7 +148,7 @@ ENTRY(_ZGVeN16v_atanhf_skx)
> >          vfmadd213ps {rn-sae}, %zmm5, %zmm3, %zmm1
> >          vmovups   poly_coeff2+__svml_satanh_data_internal_avx512(%rip), %zmm3
> >          vmovaps   %zmm3, %zmm2
> > -        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
> > +//        vfmadd231ps {rn-sae}, %zmm9, %zmm7, %zmm2
> >          vfmadd231ps {rn-sae}, %zmm4, %zmm7, %zmm3
> >          vfmadd213ps {rn-sae}, %zmm12, %zmm9, %zmm2
> >          vfmadd213ps {rn-sae}, %zmm12, %zmm4, %zmm3
> >
> > Thanks,
> > Sunil
> >
> > > pzimmermann@grvingt-63:~/svn/tbd/20/src/binary32_exhaustive$ LIBMVEC=512 GLIBC=glibc ./doit.libmvec atanh
> > > LIBMVEC=512 -mavx512f
> > > 00000000004148f0 T mpfr_atanh
> > > 0000000000401668 t mpfr_atanh.cold
> > >                  U _ZGVeN16v_atanhf@GLIBC_2.35
> > > Checking atanh with libmvec from glibc and rndn
> > > Thu 24 Feb 2022 10:28:21 AM CET
> > > MPFR library: 4.1.0
> > > MPFR header:  4.1.0 (based on 4.1.0)
> > > Checking function atanhf with MPFR_RNDN
> > > libm wrong by up to 1.45e+00 ulp(s) [1] for x=0x1.f2100ap-9
> > > atanh      gives 0x1.f210aap-9
> > > mpfr_atanh gives 0x1.f210a8p-9
> > > Total: errors=58600734 (1.37%) errors2=0 maxerr=1.45e+00 ulp(s)
> > >
> > > Best regards,
> > > Paul
> > >
> > > > Date: Wed, 23 Feb 2022 16:04:23 -0800
> > > > From: Sunil K Pandey via Libc-alpha <libc-alpha@sourceware.org>
> > > >
> > > > This patch adds following input to atanh accuracy test.
> > > >
> > > >     0x1.f80094p-8
> > > >
> > > > Tested on x86-64 and i686 platforms.
> > > > Other platforms may have to regenerate ulps file.
> > > > ---
> > > >  math/auto-libm-test-in        |  3 +++
> > > >  math/auto-libm-test-out-atanh | 25 +++++++++++++++++++++++++
> > > >  2 files changed, 28 insertions(+)
> > > >
> > > > diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> > > > index 9080afe4fb..30fbada31f 100644
> > > > --- a/math/auto-libm-test-in
> > > > +++ b/math/auto-libm-test-in
> > > > @@ -617,6 +617,9 @@ atanh -0x3.98eaf4p-4
> > > >  atanh 0x2.c1085p-4
> > > >  atanh 0x1p-500
> > > >  atanh 0x1p-5000
> > > > +# the next value generates larger error bounds in libmvec/avx512 on x86_64
> > > > +# (binary32)
> > > > +atanh 0x1.f80094p-8
> > > >  # the next value generates larger error bounds on x86_64 (binary128)
> > > >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> > > >  atanh min
> > > > diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh
> > > > index 378ef6e8cf..a5243264be 100644
> > > > --- a/math/auto-libm-test-out-atanh
> > > > +++ b/math/auto-libm-test-out-atanh
> > > > @@ -3112,6 +3112,31 @@ atanh 0x1p-5000
> > > >  = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> > > >  = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
> > > >  = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok
> > > > +atanh 0x1.f80094p-8
> > > > += atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > > > += atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > > > += atanh towardzero binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
> > > > += atanh upward binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
> > > > += atanh downward binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > > > += atanh tonearest binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > > > += atanh towardzero binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
> > > > += atanh upward binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
> > > > += atanh downward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh tonearest intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh towardzero intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh upward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > > > += atanh downward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh tonearest m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh towardzero m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
> > > > += atanh upward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
> > > > += atanh downward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > > > += atanh tonearest binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > > > += atanh towardzero binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
> > > > += atanh upward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
> > > > += atanh downward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > > += atanh tonearest ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > > += atanh towardzero ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
> > > > += atanh upward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d3p-8 : inexact-ok
> > > >  atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
> > > >  = atanh downward binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> > > >  = atanh tonearest binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
> > > > --
> > > > 2.34.1
> > > >
Paul Zimmermann Feb. 24, 2022, 4:38 p.m. UTC | #5
Dear Sunil,

>     I do not plan this patch(svml_s_atanhf16_core_avx512.S) to be
> submitted, but I want this
>     input(0x1.f80094p-8) to be included in auto-libm-test-in, as it
> can help as a checkguard for
>     changes like this in future.

ok I understand now!

I am ok with this patch.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>

Best regards,
Paul
diff mbox series

Patch

diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 9080afe4fb..30fbada31f 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -617,6 +617,9 @@  atanh -0x3.98eaf4p-4
 atanh 0x2.c1085p-4
 atanh 0x1p-500
 atanh 0x1p-5000
+# the next value generates larger error bounds in libmvec/avx512 on x86_64
+# (binary32)
+atanh 0x1.f80094p-8
 # the next value generates larger error bounds on x86_64 (binary128)
 atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
 atanh min
diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh
index 378ef6e8cf..a5243264be 100644
--- a/math/auto-libm-test-out-atanh
+++ b/math/auto-libm-test-out-atanh
@@ -3112,6 +3112,31 @@  atanh 0x1p-5000
 = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
 = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok
 = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok
+atanh 0x1.f80094p-8
+= atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
+= atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
+= atanh towardzero binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok
+= atanh upward binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok
+= atanh downward binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
+= atanh tonearest binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
+= atanh towardzero binary64 0x1.f80094p-8 : 0x1.f8031f3228153p-8 : inexact-ok
+= atanh upward binary64 0x1.f80094p-8 : 0x1.f8031f3228154p-8 : inexact-ok
+= atanh downward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh tonearest intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh towardzero intel96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh upward intel96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
+= atanh downward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh tonearest m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh towardzero m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f0ep-8 : inexact-ok
+= atanh upward m68k96 0x1.f80094p-8 : 0x1.f8031f3228153f1p-8 : inexact-ok
+= atanh downward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
+= atanh tonearest binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
+= atanh towardzero binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2afp-8 : inexact-ok
+= atanh upward binary128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d2bp-8 : inexact-ok
+= atanh downward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
+= atanh tonearest ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
+= atanh towardzero ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d28p-8 : inexact-ok
+= atanh upward ibm128 0x1.f80094p-8 : 0x1.f8031f3228153f0e56e4db72d3p-8 : inexact-ok
 atanh 0x2.c02a24f3472c7840afbd8cfb68bap-4
 = atanh downward binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok
 = atanh tonearest binary32 0x2.c02a28p-4 : 0x2.c73a3cp-4 : inexact-ok