From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4ac6504560f5ef27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-05 09:54:58 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!priapus.visi.com!orange.octanews.net!hermes.visi.com!news.octanews.net!news-out.visi.com!petbe.visi.com!news.octanews.net!in.100proofnews.com!in.100proofnews.com!cycny01.gnilink.net!cyclone1.gnilink.net!wn14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types? References: <4046b474_1@127.0.0.1> <1078425292.143938@master.nyc.kbcfp.com> In-Reply-To: <1078425292.143938@master.nyc.kbcfp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 05 Mar 2004 12:40:50 -0500 NNTP-Posting-Host: 198.96.223.163 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1078508390 198.96.223.163 (Fri, 05 Mar 2004 12:39:50 EST) NNTP-Posting-Date: Fri, 05 Mar 2004 12:39:50 EST Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:6089 Date: 2004-03-05T12:40:50-05:00 List-Id: 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 > . 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