[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: need help with cpu problem
In article <1994Jan8.184853.14886@nntpd2.cxo.dec.com>
k_bouchard@csc32.enet.dec.com (My name is...) writes:
| I noticed while running the Lego/Logo thing that comparisons didn't
| work so good. I just dismissed it as some sort of quirk of the LOGO
| language. Now,I find that running BASIC,a simple IF/THEN statement
| won't work with certain numbers (it looks like numbers with five or
| more bits can't be compared for equality)
|
| Here is a BASIC program that fails:
|
| 10 y=3
| 20 x=7
| 30 num=x^y
| 40 if num=343 then print num
| 50 end
|
| substitute x=8 and put 512 in the IF/THEN and it works. (prints out
| num)
|
| Is there some diagnostic I can run on the cpu? If there is,can I
| get it or is it proprietary like so much other stuff?
|
| BTW: In case you're wondering,yes the system speed in the control
| panel *was* set to FAST and I lowered it to NORMAL,being *sure*
| this was the problem. No luck,still fails.
|
| Ken
I don't know about whether or not LOGO makes use of Applesoft BASIC
ROMs, but if it does, it is simply a BASIC floating point math bug.
A (legal) source copy of Applesoft recommends trying one of the
following to demonstrate the bug in the FMULT routine:
PRINT 1*998244415: REM the num is supposed to be that large
or
PRINT 1*10.0000009: REM 6 zeroes after the decimal
Similar bugs appear in other floating point math routines (including
exponents and trigonometry) because Applesoft is using inaccurate
table constants for the FMULT routine.
Try using the modified:
| 40 if num=343 then print num
40 IF INT(NUM + 0.001) = 343 THEN PRINT INT(NUM + 0.001)
and see if you get what you expect.
PS: Apple preserved the FMULT bugs (features?) in Applesoft in later
machines in the interests of backward compatibility. :-)
--
Sean Dockery
dockery@griffin.cuc.ab.ca (preferred)
sbdocker@acs.ucalgary.ca (pending expiration)