public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Brad Lucier <lucier@math.purdue.edu>
Cc: gcc@gcc.gnu.org
Subject: Re: real.c implementation
Date: Fri, 18 Oct 2002 15:21:00 -0000	[thread overview]
Message-ID: <20021018183511.GL4529@redhat.com> (raw)
In-Reply-To: <200210171901.g9HJ15b19315@banach.math.purdue.edu>

On Thu, Oct 17, 2002 at 02:01:05PM -0500, Brad Lucier wrote:
> 1.	Implement algorithms where the working precision is the target
> 	precision plus two bits (guard and sticky) and apply whatever
> 	tricks there are in the literature (Tuckerman's test for 0.5ulp
> 	accuracy of sqrt, Guy Steele's and Will Clinger's algorithms for
> 	exact decimal<->binary conversions) to get the correct answers.
> 
> 2.	Implement somewhat inaccurate algorithms in an intermediate precision
> 	so large that conversion to the target precision gives correct
> 	results.
> 
> I believe that real.c adopts the second approach.

It was not *intended* that real.c adopt the second approach.

My understanding is that the guard bit is supposed to be the correct
value of the .5ulp bit, and the sticky bit is supposed to be set if
the result is not exact at the .5ulp position.

Thus one should get correct results for any target precision if the
following rules are observed:

	* The intermediate representation has _at least_ two more
	  bits than the target format.  Obviously.

	* The bit 0 of the intermediate precision is sticky; all
	  other bits contain the proper values.

	* When rounding to the target format, the guard bit is
	  read from the target's lsb-1, and the sticky bit is the
	  sum of all bits between lsb-2 and 0.

Perhaps I'm being naieve.  If this is incorrect, stop me now.
An explanation of why this is wrong would also be appreciated.

If this is correct, do we get better results for decimal<->binary
conversion if all computations are correctly rounded for, say,
a 158-bit intermediate representation?

If so, does this allow us to get correct results for the worst-case
113-bit target format with a 126-bit intermediate format?  I.e. can
we remove the extra word added the other week?  I'm guessing not, 
but I don't actually know.


r~

  reply	other threads:[~2002-10-18 18:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-17 14:16 Brad Lucier
2002-10-18 15:21 ` Richard Henderson [this message]
2002-10-19  1:07   ` Brad Lucier
2002-10-21  7:37   ` Brad Lucier
2002-10-21 17:34     ` Richard Henderson
2002-10-22  1:53       ` Fergus Henderson
2002-10-21 20:41     ` Richard Henderson
2002-10-18 17:02 Brad Lucier
2002-10-18 20:28 ` Richard Henderson
2002-10-19  2:16 Roger Sayle
2002-10-22  3:14 Robert Dewar
2002-10-22  3:36 ` Richard Henderson
2002-10-22  7:23   ` Andrew Haley
2002-10-22 11:00     ` Matt Thomas
2002-10-22 11:06       ` Andrew Haley
2002-10-22 11:11         ` Andrew Haley
2002-10-22  7:23 Robert Dewar
2002-10-22  7:41 ` Andrew Haley
2002-10-22  8:49 Robert Dewar
2002-10-22  8:50 ` Andrew Haley
2002-10-22 11:35 ` Zack Weinberg
2002-10-22 11:49 ` Richard Henderson
2002-10-22 12:34   ` Andreas Schwab
2002-10-22 17:26     ` Richard Henderson
2002-10-23  9:10       ` Andreas Schwab
2002-10-22  9:05 Robert Dewar
2002-10-22  9:19 ` Andrew Haley
2002-10-22  9:43 Robert Dewar
2002-10-22 11:56 ` Richard Henderson
2002-10-22  9:45 Robert Dewar
2002-10-22 14:35 ` Neil Booth
2002-10-22 11:04 Robert Dewar
2002-10-22 12:15 Robert Dewar
2002-10-22 12:32 ` Richard Henderson
2002-10-22 13:22 Robert Dewar
2002-10-22 23:58 Robert Dewar
2002-10-23  0:03 ` Eric Christopher
2002-10-23  0:33 Robert Dewar
2002-10-26  4:10 Stephen L Moshier
2002-10-26  8:42 Stephen L Moshier
2002-10-26  9:05 ` Brad Lucier
2002-10-26  8:43 Robert Dewar
2002-10-28  4:43 Stephen L Moshier
2002-10-28  8:34 Stephen L Moshier
     [not found] <200210281429.g9SETTeS020750@mururoa.inria.fr>
2002-10-28 11:38 ` Brigitte Verdonk

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=20021018183511.GL4529@redhat.com \
    --to=rth@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=lucier@math.purdue.edu \
    /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).