Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.alpha.net!uwm.edu!math.ohio-state.edu!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.794299834@tina.mrco.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Reply-To: knight@mrco.carleton.ca (Alan Knight)
Organization: Carleton University
References: <ab7d6b630e02100464a1@[192.55.204.253]>
Date: Sat, 4 Mar 1995 06:50:34 GMT
Lines: 31

In <ab7d6b630e02100464a1@[192.55.204.253]> David Simmons <quasar@QKS.COM> writes:

I wrote:
>>It seems people are very easily fooled by appearances. It's not that
>>Digitalk and Easel get the "right" answer, it's that they truncate the
>>number of digits on the "wrong" answer so that it looks right. Try the
>>following expressions
>>
>>(100.9 - 100.0) = 0.9
>>((100.9 - 100.0) - 0.9)
>>
>>They produce false and non-zero respectively on all 3 implementations.
>>I don't have a Mac, so I couldn't try SmalltalkAgents, but I'd bet
>>money it's the same.

>In SmalltalkAgents you get:

>    ((100.9 - 100.0) printFormatted: '%8.8f') result ... 0.90000000

Which tells us that STA's 80-bit floats are capable of giving 8
significant digits of precision. This is not news. I still bet money
that the two expressions I stated above will be false and non-zero.
Since STA uses bigger floats than anybody else, the error will be
smaller, but it's still there. This is a basic property of floating
point numbers.

-- 
 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
