Calculator Community > TI Calculators

Domain error in 83 BASIC

(1/2) > >>

Ivoah:

The text command is giving a domain error, can anyone help?


--- Code: ---
Degree:ClrDraw:ZInteger:AxesOff


Circle(0,0,25)
For(I,1,12)
I(360/12)->theta
25*sin(theta)->X
25*cos(theta)->Y
Pt-On(X,Y)
Text(2*Ymax-(Ymax+Y),Xmax+X,I)
End


{0,0,0}->|LH
{0,0,0}->|LM
{0,0,0}->|LS


Lbl L


getTime->L1
L1(1)-12*int(L1(1)/12)->|LH(1)
L1(2)->|LM(1)
L1(3)->|LS(1)


|LS(1)(360/60)->theta
Line(0,0,|LS(2),|LS(3),0)
20*sin(theta)->|LS(2)
20*cos(theta)->|LS(3)
Line(0,0,|LS(2),|LS(3))


|LM(1)(360/60)->theta
Line(0,0,|LM(2),|LM(3),0)
23*sin(theta)->|LM(2)
23*cos(theta)->|LM(3)
Line(0,0,|LM(2),|LM(3))


(|LH(1)*60+|LM(1))(360/720)->theta
Line(0,0,|LH(2),|LH(3),0)
10*sin(theta)->|LH(2)
10*cos(theta)->|LH(3)
Line(0,0,|LH(2),|LH(3))


Text(0,0,|LH(1))
Text(6,0,|LM(1))
Text(12,0,|LS(1))


Goto L

--- End code ---

Adriweb:
It's been in a long time since I've programmed in z80 basic, but if the Text command enforces the coordinates to be < Xmax / Ymax :
- I suppose (easily checkable) that Ymax+Y is lower than 2*Ymax, so the subtraction gives something still above Ymax, hence the domain error.
- Same for Xmax when X is positive

BTW, I don't remember if it allows for non-integer coords... ?

Ivoah:
Haha! Thanks! Yeah, I guess I just needed to convert them to ints. Thanks again!


EDIT: updated http://tibasicdev.wikidot.com/text

TIfanx1999:
For the text command, it is Text(Y,X,"
Y must be a value from 0-57 or you will get a domain error. If the X value is over 91 It won't show up on screen (0-91 will). Hope this helps.

Ivoah:
Adriweb found the problem, it also has to be an integer

Navigation

[0] Message Index

[#] Next page

Go to full version