Author Topic: Domain error in 83 BASIC  (Read 7037 times)

0 Members and 1 Guest are viewing this topic.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Domain error in 83 BASIC
« 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
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Domain error in 83 BASIC
« Reply #1 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... ?
« Last Edit: October 09, 2014, 06:52:32 pm by Adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Domain error in 83 BASIC
« Reply #2 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
« Last Edit: October 09, 2014, 07:07:43 pm by Ivoah »
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Domain error in 83 BASIC
« Reply #3 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.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Domain error in 83 BASIC
« Reply #4 on: October 09, 2014, 08:36:51 pm »
Adriweb found the problem, it also has to be an integer
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Domain error in 83 BASIC
« Reply #5 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

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Domain error in 83 BASIC
« Reply #6 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...
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Domain error in 83 BASIC
« Reply #7 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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Domain error in 83 BASIC
« Reply #8 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.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Domain error in 83 BASIC
« Reply #9 on: October 10, 2014, 06:29:36 am »
Good to know.
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3