Omnimaga

Calculator Community => TI Calculators => Topic started by: Ivoah on October 09, 2014, 06:48:44 pm

Title: Domain error in 83 BASIC
Post by: Ivoah on October 09, 2014, 06:48:44 pm

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

Code: [Select]

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
Title: Re: Domain error in 83 BASIC
Post by: Adriweb on October 09, 2014, 06:50:55 pm
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... ?
Title: Re: Domain error in 83 BASIC
Post by: Ivoah on October 09, 2014, 07:02:36 pm
Haha! Thanks! Yeah, I guess I just needed to convert them to ints. Thanks again!


EDIT: updated http://tibasicdev.wikidot.com/text
Title: Re: Domain error in 83 BASIC
Post by: TIfanx1999 on October 09, 2014, 07:09:03 pm
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.
Title: Re: Domain error in 83 BASIC
Post by: Ivoah on October 09, 2014, 08:36:51 pm
Adriweb found the problem, it also has to be an integer
Title: Re: Domain error in 83 BASIC
Post by: TIfanx1999 on October 09, 2014, 09:20:44 pm
Well yea, you can't put text between pixels. With my previous post I would assume someone wouldn't try to use decimals that fall in between those ranges. :P
Title: Re: Domain error in 83 BASIC
Post by: Ivoah on October 09, 2014, 09:53:26 pm
My problem was that I computed a value using sin and cos, and never converted it to an int. Line works with non int values...
Title: Re: Domain error in 83 BASIC
Post by: TIfanx1999 on October 09, 2014, 09:57:06 pm
Line isn't based on screen dimensions.  Text more or less is. Pixel is based on screen dimensions as well. If you try to draw a pixel off screen you get a dimension error just like with text.
Title: Re: Domain error in 83 BASIC
Post by: DJ Omnimaga on October 10, 2014, 12:32:31 am
Yeah the only commands that has clipping are Pt-On/Off/Chg (not Pxl-On/Off/Chg), Line, Circle and the horiz/vertical commands. Everything else has to be absolutely drawn inside the screen with integer values.
Title: Re: Domain error in 83 BASIC
Post by: Ivoah on October 10, 2014, 06:29:36 am
Good to know.