public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 1/4] Add a routine for accurate reduction mod (2pi), for j0f/j1f/y0f/y1f.
Date: Tue, 09 Feb 2021 17:32:39 +0100	[thread overview]
Message-ID: <mweehpw6ag.fsf@tomate.loria.fr> (raw)
In-Reply-To: <VE1PR08MB55999E368C3EA41FDE4CF3E1838E9@VE1PR08MB5599.eurprd08.prod.outlook.com> (message from Wilco Dijkstra on Tue, 9 Feb 2021 11:35:18 +0000)

       Dear Wilco,

> Do we really need another range reducer here? Would it be possible to use
> the
> much faster reduce_fast and reduce_large in
> sysdeps/ieee754/flt-32/s_sincosf.h?
> Given that returns a 62-bit modulo of PI/4, it should be more accurate as
> well.

yes indeed I was wondering, and too lazy so far. Your mail forced me to try.

reduce_fast is clearly not accurate enough: for x=0x1.96d666p+7, it gives
y=0x1.947b0da22168cp+8 (and n=-128), and we clearly see that y is not in
[-PI/4,PI/4] as advertized. What happens is that in the #else part of
the code that is executed on my machine, r is larger than 2^31, thus the
cast (int32_t) r overflows, the value of n is wrong, and thus the returned
value x - n * p->hpi. Maybe a comment should be added about this limitation
of reduce_fast?

As for reduce_large, I need to run again the exhaustive tests for all four
functions (j0, j1, y0, y1) and all four rounding modes to see if it is accurate
enough.

Paul


  parent reply	other threads:[~2021-02-09 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 11:35 Wilco Dijkstra
2021-02-09 13:30 ` Carlos O'Donell
2021-02-09 16:32 ` Paul Zimmermann [this message]
2021-02-09 18:27   ` Wilco Dijkstra
  -- strict thread matches above, loose matches on Subject: below --
2021-02-09  5:28 Paul Zimmermann

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

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

  git send-email \
    --in-reply-to=mweehpw6ag.fsf@tomate.loria.fr \
    --to=paul.zimmermann@inria.fr \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /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).