11-11-2012, 09:20 PM
britlion Wrote:This program was posted on the WOS forums:I've run the above code in Sinclair BASIC, and it takes 688secs. (11min. 20secs. aprox.)
Code:For x=-100 To 100
For y=-100 To 100
If (x/2-25)*(x/2-25)+(y-50)*(y-50)<200 Or (x/2+25)*(x/2+25)+(y-50)*(y-50)<200 then plot x+100,96-y
Next y
Next x
And if run as is, takes about 9 seconds in Basic, I think.
![[Image: slowrun.th.png]](http://imageshack.us/a/img580/1575/slowrun.th.png)
This is the listing:
![[Image: slowlisting.th.png]](http://imageshack.us/a/img203/8994/slowlisting.th.png)
In ZX Basic, by default it uses Byte type, it overflows, and produces a random pattern and an Out of Screen error at the end.
When declaring float, it works, but it takes *twice* the time it does with Sinclair BASIC. This is something I need to investigate further.
So using Integer is the way to go, and it takes about a minute (52 secs, as you said).
From my point of view, this is okay. There is some optimizations to be done there (e.g. common factors, etc.). I hope to have some more time to check for this.