Author Topic: Domain error when calling from a non local area  (Read 3481 times)

0 Members and 1 Guest are viewing this topic.

Offline Spartan

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
  • Spartan. Kicking ass since 480BC.
    • View Profile
Domain error when calling from a non local area
« on: December 12, 2014, 07:16:04 pm »
Hey Omnimaga, im having some troubles...

Well you see, i have this chunk of code here :

Code: [Select]
Define LibPub convert(str,str2)=
Prgm
:©convert("value","unit"): Unit conversion
:
:
:Local out,num,expr1,expr2
:setMode(4,3)
:
:If getType(str)≠"STR" or getType(str2)≠"STR"
:  error("argument")
:
:If inString(str&str2,"+")≠0 or inString(str&str2,"-")≠0
:  error("syntax")
:
:©No dimension
:Local none
:1→none
:
:©Length units
:Local ang,au,cm,fath,fm,ft,in,km,ltyr,m,μ,mi,mil,mm,nmi,pc,rod,yd,å
:1.*^(*√(2))→m
:1.−10*m→ang
:149597900000*m→au
:0.01*m→cm
:1.8288*m→fath
:1.−15*m→fm
:0.3048*m→ft
:0.0254*m→in
:1000.*m→km
:9.4605284048815*m→ltyr
:1.−6*m→μ
:1609.344*m→mi
:2.54−5*m→mil
:0.001*m→mm
:1852.*m→nmi
:3.08567816*m→pc
:5.0292*m→rod
:0.9144*m→yd
:1.−10*m→å
:
:
:©Area units
:Local acre,ha
:4046.8564224*m^(2)→acre
:10000.*m^(2)→ha
:
:
:©Volume units
:Local cup,floz,flozuk,gal,galuk,l,ml,pt,qt,tbsp,tsp
:2.365882365−4*m^(3)→cup
:2.95735295625−5*m^(3)→floz
:2.84130625−5*m^(3)→flozuk
:0.003785411784*m^(3)→gal
:0.00454609*m^(3)→galuk
:0.001*m^(3)→l
:1.−6*m^(3)→ml
:4.73176473−4*m^(3)→pt
:9.46352946−4*m^(3)→qt
:1.47867647813−5*m^(3)→tbsp
:4.92892159375−6*m^(3)→tsp
:
:
:©Time units
:Local day,hr,μs,minute,ms,ns,s,week,yr
:^(*√(3))→s
:86400.*s→day
:3600.*s→hr
:1.−6*s→μs
:60.*s→minute
:0.001*s→ms
:1.−9*s→ns
:604800.*s→week
:31556925.9747*s→yr
:
:
:©Velocity units
:Local knot,kph,mph
:0.514444444444*((m)/(s))→knot
:0.277777777778*((m)/(s))→kph
:0.44704*((m)/(s))→mph
:
:©Temperature units
:Local θk,θc,θf,θr
:^(*√(5))→θk
:θk→θc
:0.555555555556*θk→θf
:0.555555555556*θk→θr
:
:©Luminous intensity units
:Local cd
:^(*√(7))→cd
:
:
:©Amount of substance units
:Local mol
:^(*√(11))→mol
:
:
:©Mass units
:Local amu,gm,kg,lb,mg,mton,oz,slug,ton,tonne,tonuk
:^(*√(13))→kg
:1.6605402−27*kg→amu
:0.001*kg→gm
:0.45359237*kg→lb
:1.−6*kg→mg
:1000.*kg→mton
:0.028349523125*kg→oz
:14.5939029372*kg→slug
:907.18474*kg→ton
:1000.*kg→tonne
:1016.047*kg→tonuk
:
:
:©Force units
:Local dyne,kgf,lbf,n,tonf
:((kg*m)/(s^(2)))→n
:1.−5*n→dyne
:9.80665*n→kgf
:4.44822161526*n→lbf
:8896.44323052*n→tonf
:
:
:©Energy units
:Local btu,cal,erg,ev,ftlb,j,kcal,kwh,latm
:n*m→j
:1055.05585262*j→btu
:4.1868*j→cal
:1.−7*j→erg
:1.60217733−19*j→ev
:1.35581794833*j→ftlb
:4186.8*j→kcal
:3600000.*j→kwh
:101.325*j→latm
:
:
:©Power units
:Local w,kw,hp
:j*s→w
:745.699871582*w→hp
:1000.*w→kw
:
:
:©Pressure units
:Local atm,bar,inh2o,inhg,mmh2o,mmhg,pa,psi,torr
:((n)/(m^(2)))→pa
:101325.*pa→atm
:100000.*pa→bar
:249.08891*pa→inh2o
:3386.38815789*pa→inhg
:9.80665*pa→mmh2o
:133.32236*pa→mmhg
:6894.75729317*pa→psi
:133.322368421*pa→torr
:
:
:©Kinematic viscosity units
:Local st
:1.−4*((m^(2))/(s))→st
:
:
:©Dynamic viscosity units
:Local p
:0.1*((kg)/(m*s))→p
:
:
:©Frequence units
:Local ghz,hz,khz,mhz
:((1)/(s))→hz
:1000000000.*hz→ghz
:1000.*hz→khz
:1000000.*hz→mhz
:
:
:©Current units
:Local a,ma,μa,ka
:^(*√(17))→a
:1000.*a→ka
:0.001*a→ma
:1.−6*a→μa
:
:
:©Charge units
:Local coul
:a*s→coul
:
:
:©Potential units
:Local v,volt,mv,kv
:((w)/(a))→v
:v→volt
:0.001*v→mv
:1000.*v→kv
:
:©Resistence units
:Local kω,mω,ohm,ω
:((v)/(a))→ω
:1000.*ω→kω
:1000000.*ω→mω
:1.*ω→ohm
:
:
:©Conductance units
:Local mho,mmho,siemens,μmho
:((1)/(ω))→siemens
:1.*siemens→mho
:0.001*siemens→mmho
:1.*siemens→siemens
:1.−6*siemens→μmho
:
:
:©Capacitance units
:Local f,nf,pf,μf
:((coul)/(v))→f
:1.−9*f→nf
:1.−12*f→pf
:1.−6*f→μf
:
:
:©Magnetic field strength units
:Local oe
:79.5774715459*((a)/(m))→oe
:
:
:©Magnetic flow units
:Local wb
:v*s→wb
:
:
:©Magnetic flow density units
:Local t,gs
:((wb)/(m^(2)))→t
:1.−4*t→gs
:
:
:©Inductance units
:Local henry,mh,nh,μh
:((wb)/(a))→henry
:0.001*henry→mh
:1.−9*henry→nh
:1.−6*henry→μh
:
:
:©Constants
:Local c,cc,g,gc,h,k,μ0,μb,me,mn,mp,na,q,rb,rc,rdb,vm,ε0,σ,φ0
:299792458.*((m)/(s))→c
:8987551787.37*((m)/(f))→cc
:9.80665*((m)/(s^(2)))→g
:6.6742−11*((m^(3))/(kg*s^(2)))→gc
:6.6260693−34*((kg*m^(2))/(s))→h
:1.3806505−23*((j)/(θk))→k
:1.25663706144−6*((n)/(a^(2)))→μ0
:9.27400949−24*a*m^(2)→μb
:9.1093826−31*kg→me
:1.67492728−27*kg→mn
:1.67262171−27*kg→mp
:6.022141523*((1)/(mol))→na
:1.60217653−19*coul→q
:5.291772108−11*m→rb
:8.314472*((j)/(mol*θk))→rc
:10973731.5685*((1)/(m))→rdb
:0.022413996*((m^(3))/(mol))→vm
:8.85418781762−12*((f)/(m))→ε0
:5.6704−8*((kg)/(s^(3)*θk^(4)))→σ
:2.06783372−15*wb→φ0
:
:
:©Units defined. Do the conversion
:
:
:Try
: expr(str)→expr1
: expr(str2)→expr2
:Else
:  error("syntax")
:EndTry
:((expr1)/(expr2))→num
:If abs(angle(num))>10^(−5) and abs(angle(num)-π)>10^(−5)
:  error("inconsistent")
:
:
:real(num)→num
:expr("Disp """&string(num)&" · "&str2&"""")
:EndPrgm

And when this function is called from another area that does not have this function declared in the local public library in the current problem?
I have no idea why, but this message is always being thrown : "Domain Error : An argument must be specified in a specific domain" :( and i cant see where the problem is... anyone help ? :O

Just to note, the code runs perfectly fine when declared in the local public variables, such as when ran from the MyLib folder and adding a new page and calling the function from there :@ It was working absolutely fine earlier, come back to it and this happens.   :mad:
Add me on steam :

My Steam Profile (from SteamDB)

  • Worth: £1117 (£294 with sales)
  • Games owned: 106
  • Games not played: 69 (65%)
  • Hours on record: 770.5h
Chris

Offline Spartan

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
  • Spartan. Kicking ass since 480BC.
    • View Profile
Re: Domain error when calling from a non local area
« Reply #1 on: December 13, 2014, 08:06:36 am »
FIXED :
For anyone else with recurrent problems with calling a public library from another area but not within the document where they were defined, i found the fix to be to simply reinstall the OS. This does not delete the documents either, so its a simple process :) im still not sure why this is a fix, maybe someone with abit more knowledge on the TI Basic language can enlighten me.
 
Add me on steam :

My Steam Profile (from SteamDB)

  • Worth: £1117 (£294 with sales)
  • Games owned: 106
  • Games not played: 69 (65%)
  • Hours on record: 770.5h
Chris

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: Domain error when calling from a non local area
« Reply #2 on: December 13, 2014, 10:29:12 am »
Shouldn't it be enough to refresh the libraries? I don't know much about TI Basic, though ;)

Offline Spartan

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
  • Spartan. Kicking ass since 480BC.
    • View Profile
Re: Domain error when calling from a non local area
« Reply #3 on: December 13, 2014, 07:05:46 pm »
Shouldn't it be enough to refresh the libraries? I don't know much about TI Basic, though ;)
No, for some reason it is not. i even tried deleting the old file, refreshing, then adding it back into the mylib folder and refresh again to no avail. its something to do with the program storing some error message in the current OS and it dosent even run the code when i call it, it instantly throws the message. that is the only fix i found, reinstalling the OS :)
Add me on steam :

My Steam Profile (from SteamDB)

  • Worth: £1117 (£294 with sales)
  • Games owned: 106
  • Games not played: 69 (65%)
  • Hours on record: 770.5h
Chris