Newsgroups: comp.lang.scheme,comp.lang.c++,comp.lang.java.programmer
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!newstand.syr.edu!news.maxwell.syr.edu!mr.net!news.idt.net!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!swrinde!sdd.hp.com!col.hp.com!news.dtc.hp.com!hplntx!hplb!cdollin!kers
From: kers@hplb.hpl.hp.com (Chris Dollin)
Subject: Re: Divison.  Was Re: 10 Reasons Why Scheme is Better Than C/C++
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Message-ID: <KERS.96Dec5095913@cdollin.hpl.hp.com>
In-Reply-To: mcdermid@hcl.com's message of 4 Dec 1996 20:36:01 GMT
Date: Thu, 5 Dec 1996 16:59:13 GMT
References: <57g0qm$pqs@netnews.upenn.edu>
	<329C637E.5DA@netright.com><57g0qm$pqs@netnews.upenn.edu>
	<329C637E.5DA@netright.com> <4nenh74apf.fsf_-_@rtp.ericsson.se>
	<584nbh$11j@news.hcl.com>
Nntp-Posting-Host: cdollin.hpl.hp.com
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Lines: 29
Xref: glinda.oz.cs.cmu.edu comp.lang.scheme:17576 comp.lang.c++:231401 comp.lang.java.programmer:23177

In article <584nbh$11j@news.hcl.com> mcdermid@hcl.com (Robert McDermid) writes:

   BTW, 1/3 is an irrational, not a rational, 

This will be news to many generations of mathematicians. 1/3 is more rational
than I am.

   and there's no way to represent that precisely at all (using floating 
   point) on a computer.

Certainly there is; just use base 3 arithmetic. (Of course you'll have to
*implement* it all, which is a tad tricky, and there might be a little 
performance reduction, but the principle's sound.)

Perhaps you mean that 1/3 has no finte exact representation in base 2 (or
10)? That's rather different from being ``irrational'', surely?

   Thus, in the example you give, y will never equal x no matter
   what computer language you use.  (Do any of the symbolic manipulation
   packages like Maple have a way of handling this better?)

Yes, they represent 1/3 as 1/3. The obvious implementation that comes to mind
is to represent a rational as a pair of integers with highest common factor
1. (That's what Poplog does, although it's not a symbolic manipulation 
package.)
--

Regards,    | "You're better off  not dreaming of  the things to come;
Kers.       | Dreams  are always ending  far too soon." - Caravan.
