Hi there.
I was definitely wrong about there being a bug in |MUL in my previous post, but it appears that something may be wrong with SUB.
This program is not yet complete (it doesn't plot anything on screen yet), but it calculates points to display a 3d cone.
There is a command: |SUB,tmpYb,tmpY,sin2
i.e. tmpYb=tmpY-sin2
When I print tmpYb in line 410, I get 119 appearing several times, then 121, then 123 etc.
This is correct.
But if I use the code in line 401: |SUB,tmpY,tmpY,sin2
i.e. tmpY=tmpY-sin2
I only get zeroes being printed by line 420.
So it appears that |SUB is flawed when a variable is subtracting something from itself.
I can certainly get around this problem by using tmpYb - I just thought you'd like to know.
I don't know if any of the other RSX commands have similar problems when a variable operates on itself.
Using |ADD for tmpY to add something to itself seems to be OK though...
I was definitely wrong about there being a bug in |MUL in my previous post, but it appears that something may be wrong with SUB.
This program is not yet complete (it doesn't plot anything on screen yet), but it calculates points to display a 3d cone.
- Code:
10 piDouble=0:piDouble61=1:const61=2:piDouble193=3:const193=4:piHalf=5:const2=6:piOffset=7
20 sin1=8:const1=9:const30=10:tmpY=11:const119=12:sin2=13:tmpYb=14:const400=15
50 |PI,piDouble:|ADD,piDouble,piDouble,piDouble
51 |CREAL,const61,61:|DIV,piDouble61,piDouble,const61
52 |CREAL,const193,193:|DIV,piDouble193,piDouble,const193
53 |CREAL,const2,2:|PI,piHalf:|DIV,piHalf,piHalf,const2
54 |SUB,piOffset,piDouble,piHalf
55 |CREAL,const1,1
56 |CREAL,const30,30
57 |CREAL,const119,119
58 |CREAL,const400,400
100 MODE 2:PAPER 0:CLS:INK 0,0
200 FOR a=0 TO 61 STEP 2
210 |CREAL,sin1,a:|MUL,sin1,sin1,piDouble61:|ADD,sin1,sin1,piOffset:|SIN,sin1,sin1:|ADD,sin1,sin1,const1
300 FOR v=0 TO 193':LOCATE 1,1:PRINT v
310 |CREAL,sin2,v:|MUL,sin2,sin2,piDouble193:|ADD,sin2,sin2,piOffset:|SIN,sin2,sin2:|ADD,sin2,sin2,const1
400 |MUL,sin2,sin1,sin2:|MUL,sin2,sin2,const30:|CREAL,tmpY,a:|ADD,tmpY,tmpY,const119:|SUB,tmpYb,tmpY,sin2
401 |SUB,tmpY,tmpY,sin2
410 '|CINT,@py,tmpYb:PRINT py;" ";
420 |CINT,@py,tmpY:PRINT py;" ";
500 NEXT:NEXT
There is a command: |SUB,tmpYb,tmpY,sin2
i.e. tmpYb=tmpY-sin2
When I print tmpYb in line 410, I get 119 appearing several times, then 121, then 123 etc.
This is correct.
But if I use the code in line 401: |SUB,tmpY,tmpY,sin2
i.e. tmpY=tmpY-sin2
I only get zeroes being printed by line 420.
So it appears that |SUB is flawed when a variable is subtracting something from itself.
I can certainly get around this problem by using tmpYb - I just thought you'd like to know.
I don't know if any of the other RSX commands have similar problems when a variable operates on itself.
Using |ADD for tmpY to add something to itself seems to be OK though...