comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <warren@ve3wwg.tk>
Subject: Re: Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types?
Date: Fri, 05 Mar 2004 12:40:50 -0500
Date: 2004-03-05T12:40:50-05:00	[thread overview]
Message-ID: <GX22c.15806$JZ6.482219@news20.bellglobal.com> (raw)
In-Reply-To: <1078425292.143938@master.nyc.kbcfp.com>

Hyman Rosen wrote:

> Warren W. Gay VE3WWG wrote:
>> you can still represent a machine dependant number with
>  > repeating decimal places
> 
> There are no such numbers (on any common hardware). 

Because I am not in a position here and now to
say "here is one", all I can do is say "I _think_ you're
incorrect about this". I seem to recall one or more
machine formats that keep one bit of state that says
this is a repeating digit (perhaps I am thinking of
a FPU register, but I do know that I have seen
it somewhere).

> Whether
> it's IEEE, VAX, or any of a variety of other forms of hardware
> floating point representation, all of them can be written
> exactly as a finite length decimal number (not counting the
> bit patterns which do not represent numbers, of course).

So lacking any representation sources at the moment, are you
saying that there is absolutely no bit that indicates that
a digit repeats?  I am not sure that you are wrong - but I
seem to recall differently.  Perhaps, someone can provide
the relevant details.

>> If they don't do that, then the number has been rounded,
>> and thus does not quite represent the original value any
>> more ;-)   (at a minimum, it is less faithful than it
>> could be).
> 
> The OP was converting out of and back into the same representation.
> Given that, there are a pair of published algorithms which ensure
> completely faithful translation. 

And one such piece of information might be that the digit
repeats (1 bit, unless a group repeats).

> One algoritm takes a decimal
> representation and converts it to the binary representation closest
> in value (coin flip for ties) and the other finds a shortest decimal
> representation for a binary number which will convert back exactly to
> that binary.

None of that is new to me ;-)

> The algorithms were both published in Proceedings of the ACM SIGPLAN
> '90 Conference on Programming Language Design and Implementation.
> 
>     G. L. Steele Jr. and J. L. White.
>     How to Print Floating Point Numbers Accurately.
> 
>     W. D. Clinger
>     How to Read Floating Point Numbers Accurately
> 
> You can find free implementations of these algorithms in C at
> <http://www.netlib.org/fp/>.

Can you point me/us to an online IEEE format description? I'd
like to check my memory for parity errors ;-)

-- 
Warren W. Gay VE3WWG
http://ve3wwg.tk




  reply	other threads:[~2004-03-05 17:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-25  9:38 Little Endian -> Big Endian (Ada95 / GNAT) James Amor
2004-02-25 12:23 ` David C. Hoos
2004-02-26 15:43   ` James Amor
2004-02-26  5:59 ` Simon Wright
2004-02-27 20:38   ` Guillaume Foliard
2004-02-28 11:27   ` Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types? Joachim Schr�er
2004-02-29 16:32     ` Simon Wright
2004-03-04  5:32     ` pburnand0-news
2004-03-04 11:55       ` Little Endian -> Big Endian (Ada95 / GNAT),Whats " David C. Hoos
2004-03-04 13:12         ` Little Endian -> Big Endian (Ada95 / GNAT), Whats " Marius Amado Alves
2004-03-04 17:51           ` Warren W. Gay VE3WWG
2004-03-04 18:34             ` Hyman Rosen
2004-03-05 17:40               ` Warren W. Gay VE3WWG [this message]
2004-03-05 17:50                 ` Warren W. Gay VE3WWG
2004-03-05 13:48             ` pburnand0-news
2004-03-05 17:34               ` Warren W. Gay VE3WWG
2004-03-05 17:53                 ` Warren W. Gay VE3WWG
2004-03-05 13:29           ` pburnand0-news
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox