Basic Error
Basic Error
I saw this in an old TI99 4/A newsletter where they was tesing a small basic program on multiple machines. The interesting thing is that the program has the same errors on the TS1000 and Commodore 64. Why would that be? Did they share the same floating point routines?
The program in question:
100 FOR N=1 TO 100
110 IF SQR(N) <> INT(SQR(N)) THEN 130
120 PRINT N
130 NEXT N
140 END
And here is a snip of the newsletter detailing the problem and result on each system
Bill H
The program in question:
100 FOR N=1 TO 100
110 IF SQR(N) <> INT(SQR(N)) THEN 130
120 PRINT N
130 NEXT N
140 END
And here is a snip of the newsletter detailing the problem and result on each system
Bill H
Re: Basic Error
As far as I can recall the "rom bug" only showed up on fractional computations the most famous being sqr .25 the answers to the numbers missed are all integer values,Bill H wrote:I saw this in an old TI99 4/A newsletter where they was tesing a small basic program on multiple machines. The interesting thing is that the program has the same errors on the TS1000 and Commodore 64. Why would that be? Did they share the same floating point routines?
The program in question:
100 FOR N=1 TO 100
110 IF SQR(N) <> INT(SQR(N)) THEN 130
120 PRINT N
130 NEXT N
140 END
And here is a snip of the newsletter detailing the problem and result on each system
Bill H
without refitting som of the bugged roms I have I can't really comment but the program as listed works ok on My second issue roms.
The problem was ironed out by about 82-83 whats the date on the article, Bill, post 83 the problem was sorted or they have used a very early machine?
Re: Basic Error
It was from December 1984
Bill H
Bill H
Re: Basic Error
Hmm a c64 and a zeddy with identical flaws but two different processor types different rom authors an ocean of seperation and a common outcome. time to fit the old roms and check this out if only for the exercise.Bill H wrote:It was from December 1984
Bill H
Watch this space.
Moggy
Re: Basic Error
My results (using EO 1.0) are:
Printed values: 1 4 9 16 64
Runtime: 24 seconds in FAST mode
So the timing is correct. But the values are different (no error at 9, error at 49 and 81). Maybe they mixed the results?
Siggi
Printed values: 1 4 9 16 64
Runtime: 24 seconds in FAST mode
So the timing is correct. But the values are different (no error at 9, error at 49 and 81). Maybe they mixed the results?
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Basic Error
Siggisiggi wrote:My results (using EO 1.0) are:
Printed values: 1 4 9 16 64
Runtime: 24 seconds in FAST mode
So the timing is correct. But the values are different (no error at 9, error at 49 and 81). Maybe they mixed the results?
Siggi
That could possibly be true. If they mixed the TRS80 model 1 and the Timex Sinclair 1000 results. As far as I recall Microsoft wrote the original commodore pet basic that the commodore 64 was based on and the trs80 model 1 with the XB (expansion unit) is level 2 basic which was a microsoft product.
Bill H
Re: Basic Error
Just ran this on an old rom zeddy and got the same answers as siggi yet if You ask for the sqr of these numbers as a direct command either int or not You get correct results ie sqr 9=3 or Int sqr 9=3. So , does the fault lie in the basic interpreter as opposed to the calculator routines? Or Have I got this wrong and it's the numbers not printed that are at fault? Either way direct command entries show what appears to be correct answers so is it a rounding error?
Moggy
Moggy
Re: Basic Error
I think this might shed some light on the problem.
Moggy
Moggy
- Attachments
-
- zx maths.rar
- (247.51 KiB) Downloaded 288 times
Re: Basic Error
A test with the Shoulders of Giants rom (sg81) (with better floating-point math routines) with EO gave:
Printed values are:
1 4 9 16 25 36 49 64 81 100
within 13 seconds.
So there are no calculation errors and it works much faster than the original ZX81 rom.
Siggi
Printed values are:
1 4 9 16 25 36 49 64 81 100
within 13 seconds.
So there are no calculation errors and it works much faster than the original ZX81 rom.
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Basic Error
It is slightly quicker by about half a second in FAST mode if you use:
IF NOT SQR (N) = INT(SQR(N)) THEN GOTO 130
IF NOT SQR (N) = INT(SQR(N)) THEN GOTO 130