unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Cc: libc-alpha@sourceware.org, joseph@codesourcery.com
Subject: Re: [PATCH] Fix the inaccuracy of j0f (BZ 14469) and y0f (BZ 14471) [v2]
Date: Mon, 25 Jan 2021 10:01:40 -0300	[thread overview]
Message-ID: <40700a2f-ee93-4b2f-2f62-a8d27e7a7d6b@linaro.org> (raw)
In-Reply-To: <mw35ypl4lp.fsf@oignon.loria.fr>

On 25/01/2021 06:59, Paul Zimmermann wrote:
>        Dear Adhemerval,
> 
>> So if I understand correctly, you patch increase the ulps for non-default
>> rounding for this specific inputs? If it were the case, could be fix it
>> as well? 
> 
> I guess the previous code already had an error > 9 ulps on this specific
> input:
> 
> Failure: Test: j0_downward (0x3.17bcfcp+4)
> Result:
>  is:          1.1670220923447945e-04   0x1.e97c0b0296dc8p-14
>  should be:   1.1670220923447976e-04   0x1.e97c0b0296ddfp-14
>  difference:  3.1170812458958252e-19   0x1.7000000000000p-62
>  ulp       :  23.0000
>  max.ulp   :  2.0000
> 
> However on my machine I have an error of only 9 ulps for that input.
> Maybe your machine doesn't have fma? Maybe I should develop my code
> on a machine without fma, assuming the errors will be smaller with fma.
> 
> Paul
> 

My machine is not really the issue, although it does support FMA3 (it is
i7-4790K haswell).  The issue is we need to handle the all possible
compiler options used, which is my case it is the default for the x86_64
compiler produces with build-many-glibcs.py.

Using -march=native, the maximum error does improve although it is still
large in some cases (below).

For the FMA issue, newer implementation handles it by checking __FP_FAST_FMA
and using __builtin_fma{f,l}.  Check the double e_log2.c implementaion
(3e08ff544b86834cd).

$ cat math/test-float-j0.out 
testing float (without inline functions)
Failure: Test: j0_towardzero (0x3.17bcfcp+4)
Result:
 is:          1.16702285e-04   0x1.e97c20p-14
 should be:   1.16702205e-04   0x1.e97c0ap-14
 difference:  8.00355337e-11   0x1.600000p-34
 ulp       :  11.0000
 max.ulp   :  7.0000
Failure: Test: j0_upward (0x3.17bcfcp+4)
Result:
 is:          1.16702315e-04   0x1.e97c28p-14
 should be:   1.16702213e-04   0x1.e97c0cp-14
 difference:  1.01863407e-10   0x1.c00000p-34
 ulp       :  14.0000
 max.ulp   :  5.0000

Test suite completed:
  164 test cases plus 160 tests for exception flags and
    160 tests for errno executed.
  2 errors occurred.

$ cat math/test-double-j0.out 
testing double (without inline functions)
Failure: Test: j0 (0x3.17bcfcp+4)
Result:
 is:          1.1670220923447967e-04   0x1.e97c0b0296dd8p-14
 should be:   1.1670220923447977e-04   0x1.e97c0b0296ddfp-14
 difference:  9.4867690092481638e-20   0x1.c000000000000p-64
 ulp       :  7.0000
 max.ulp   :  5.0000
Maximal error of `j0'
 is      : 7 ulp
 accepted: 5 ulp
Failure: Test: j0_downward (0x3.17bcfcp+4)
Result:
 is:          1.1670220923447949e-04   0x1.e97c0b0296dcbp-14
 should be:   1.1670220923447976e-04   0x1.e97c0b0296ddfp-14
 difference:  2.7105054312137610e-19   0x1.4000000000000p-62
 ulp       :  20.0000
 max.ulp   :  2.0000

Test suite completed:
  204 test cases plus 200 tests for exception flags and
    200 tests for errno executed.
  3 errors occurred.

      reply	other threads:[~2021-01-25 13:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 10:43 [PATCH] Fix the inaccuracy of j0f (BZ 14469) and y0f (BZ 14471) [v2] Paul Zimmermann
2021-01-22 13:04 ` Adhemerval Zanella via Libc-alpha
2021-01-22 14:23   ` Paul Zimmermann
2021-01-22 14:37     ` Adhemerval Zanella via Libc-alpha
2021-01-22 15:06       ` Joseph Myers
2021-01-25  9:59       ` Paul Zimmermann
2021-01-25 13:01         ` Adhemerval Zanella via Libc-alpha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40700a2f-ee93-4b2f-2f62-a8d27e7a7d6b@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=Paul.Zimmermann@inria.fr \
    --cc=adhemerval.zanella@linaro.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).