Newsgroups: comp.lang.smalltalk, comp.object
Path: utzoo!utgpu!cunews!bnrgate!bqnes74!news
From: CWatts@BNR.CA (Carl Watts)
Subject: Re: Integer / Float arithmetic in ST80 (Some benchmarks)
Message-ID: <1991May30.182005.17074@bqnes74.bnr.ca>
Sender: news@bqnes74.bnr.ca
Organization: Bell Northern Research
Date: Thu, 30 May 91 18:20:05 GMT

Dear klimas@iccgcc.decnet.ab.com,

Theres a big problem I think with your "2499 Savage Test" code for Smalltalk.  You expressed it as:
	1 to: 2499 by: 1 do: [:a | a:= (a*a) sqrt ln exp arcTan tan + 1]

First of all, in Smalltalk-80 2.5 this loop will only execute about 1250 times, not 2499 times.  The "a" is being incremented twice each time through the loop.  Once by the to:by:do: and once by the "+1".

Also the assignment "a:=" inside the loop should have no affect at all to the next invocation of the loop.  Unfortunately because of a bug in the Compilers inlining of the code for the method to:do:, it actually does have an affect in Smalltalk-80 2.5, I'm not sure if it does in Smalltalk V.

In Smalltalk-80 4.0, this expression won't even execute at all, you will get an error from the Compiler telling you that it is illegal to assign to an argument like that.

If this bug in Smalltalk 2.5 was not present then the loop would execute 2499 times but then the "a :=" would have no effect whatsover.

Anyway, I think what you really want is:

| a |
a := 1.
2499 timesRepeat: [
	a := (a*a) sqrt ln exp arcTan tan + 1]

if you are interested in the final value of "a" after the loop is finished.
FYI:  The final value of a in this expression (for Smalltalk-80 2.5) is 2477.24 not 2500 as infinite precision would give you.

Since you're Smalltalk timings for this benchmark are off by 50% (approx) you should redo your benchmarks and publish them again.
