Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!howland.reston.ans.net!torn!nott!cunews!tina.mrco.carleton.ca!knight
From: knight@mrco.carleton.ca (Alan Knight)
Subject: Re: Substraction Problems :-(
Message-ID: <knight.794252902@tina.mrco.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Reply-To: knight@mrco.carleton.ca (Alan Knight)
Organization: Carleton University
References: <3ivu79$hsc@panix3.panix.com> <3j5kh2$a6f@news1.delphi.com> <3j7iog$l6h@crchh327.bnr.ca>
Date: Fri, 3 Mar 1995 17:48:22 GMT
Lines: 30

In <3j7iog$l6h@crchh327.bnr.ca> Allen Ethridge <ethridge@bnr.ca> writes:

>jsutherland@BIX.com (Jeff Sutherland) wrote:

>Still, it seems to me, especially
>in a language like Smalltalk, that the system/compiler should
>be smart enough to figure out that there is only one significant
>digit after the decimal point and adjust accordingly.  Isn't the
>size of an integer in Smalltalk limited only by available memory?
>If so, why are floating point calculations not equally unrestricted?

Now there's an interesting idea. I don't think it's as easy as with
integers, though.With integers you can use the standard machine
integers until they get too big and then switch to the slower,
unrestricted size version without losing anything. With floats it's
not nearly so clear when you've got too many significant digits. You
could use unrestricted-size floats all the time, but then you can't
use a floating point co-processor and your operations will be *much*
slower. Also, it's not clear how many digits of precision you need to
keep.  0.1 cannot be accurately represensted in binary, so there is
always going to be an error, it's just a matter of how far down it
gets pushed. Fixed-point or BCD would work, and some Smalltalk's now
support these (ParcPlace has fixed, Easel has Fixed and BCD, not sure
about others).

-- 
 Alan Knight                | The Object People
 knight@acm.org             | Smalltalk and OO Training and Consulting
 alan_knight@mindlink.bc.ca | 509-885 Meadowlands Dr.
 +1 613 225 8812            | Ottawa, Canada, K2C 3N2
