Author Topic: Axe String to Ti-Float Parser issues  (Read 2353 times)

0 Members and 1 Guest are viewing this topic.

Offline Jsec42

  • LV2 Member (Next: 40)
  • **
  • Posts: 20
  • Rating: +0/-0
    • View Profile
Axe String to Ti-Float Parser issues
« on: February 07, 2014, 08:49:41 am »
Alright, I've decided to work on a String to Float parser in axe ;D. It is incomplete as of yet, but I need to get critical parts of the program finished as of yet. My current source code is as follows.
Code: [Select]
.NP
GetCalc("Str1")->A
{A-2}^^r^^r->E
0->{A+E}
[r2]->B
Disp A,[i]
0->C
0->D
If {A}=176
A+1->A
|E80->C
End
While {A}='0'
A+1->A
If length(A)=0
Goto EXIT
End
End
If {A}=58
A+1->A
~1->D
While {A}='0'
A+1->A
D-1->D
If length(A)=0
Goto EXIT
End
End
Else
inData(A,58)->D
If D=0
length(A)-2->D
Else
D-2->D
End:End
Disp D>Dec,[i]
|E80+D+C^^r^^r->C
Disp C>Hex
Lbl EXIT
As you can see, it doesn't(yet ) make any attempt to parse the numeric data in the string ;). It parses negative numbers perfectly :P, and it has no problem getting the 10^x value from integers.The problems start when you feed it a floating point number :mad:. With a number with an integer part before the ".", it parses the thing as an integer, and returns the wrong value for the 10^x, as if it was not anticipating the decimal point, or not parsing it otherwise. What scares me, though, is when a number is parsed WITHOUT the integer part, it returns nothing at all :o. Can I please see some assistance here, if possible? ??? I will post the source code and ti-basic lib version here when completed.

Edit-found the problem with the 0 decimal parsing - Misplaced end! :evillaugh: Still doesn't parse the floating point (ex. 12.345) correctly, though
« Last Edit: February 07, 2014, 11:27:11 am by Jsec42 »


Computer Science is not the only science that matters, but it's definitely the most interesting.