Author |
Message |
chrispminis

|
Posted: Sun Mar 19, 2006 8:14 pm Post subject: Logic Problem? Left bound > Right bound. |
|
|
Alright, I'm working on a text calculator, that was described here earlier. Currently I'm working on procedures that identify and prioritize certain symbols according to PEDMAS, and i just finished that. I just started working on a procedure that identifies numbers. I have managed to detect where numbers start and end, using my symbol markers... But the problem lies, when I attempt to use my custom strreal function to translate the numbers value, I get the error. Left bound of substring exceeds right bound by more than 1. The problem I think is just my logic, but I can't figure out my problem. If you need an explanation as to what the program as doing at that moment just ask. Well, run it and tell me what I did wrong.
Description: |
|
 Download |
Filename: |
TextCalculator2.t |
Filesize: |
4.61 KB |
Downloaded: |
90 Time(s) |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
MysticVegeta

|
Posted: Mon Mar 20, 2006 6:47 pm Post subject: (No subject) |
|
|
Where is the code?
|
|
|
|
|
 |
person
|
Posted: Mon Mar 20, 2006 7:48 pm Post subject: (No subject) |
|
|
MysticVegeta wrote: Where is the code?
What are u taling about?
|
|
|
|
|
 |
Delos

|
Posted: Mon Mar 20, 2006 9:47 pm Post subject: (No subject) |
|
|
Your error appears to be here:
code: |
if symbol (j).sused then
number (i).nend := symbol (j).smark
exit
end if
|
Your problem lies in your assignment of .nend, which apparently never has that clause initiate it! Try it, echo an error message in an else condition to that clause and it should pop up quite frequently.
Also, notice the reformat I did of the code (very minor).
code: |
if symbol (j).sused = true then
% condensed to
if symbol (j).sused then
|
This is possible due to the boolean nature of said variables.
|
|
|
|
|
 |
chrispminis

|
Posted: Mon Mar 20, 2006 11:29 pm Post subject: (No subject) |
|
|
Eum.. not sure exactly what you're talking about... but.. after a good (not really but still sleep is sleep) night's rest, the problem resolved itself. It turned out i was defining an invisible number past the last symbol, and since the invisible thing after that had a value of zero it was smaller. Instead I have another problem, but after a period of debugging ive isolated the problem. It lies within my emulated strreal function. The problem is that, if you'll see the test output at the end where stringy is a 7+ digit number, the first output works fine, but the second value returned also includes the first one? Try it with different combos and you'll see what I mean.
code: | var stringy : string
var number : real := 0
var mark : int
var dec : boolean := false
function stringreal (str : string) : real
mark := index (str, ".")
if mark > 0 then
dec := true
end if
for i : 1 .. length (str)
if str (i) >= "1" and str (i) <= "9" then
number *= 10
number += (ord (str (i)) - 48)
end if
end for
if dec = true then
number := number / (10 ** (length (str) - mark))
end if
result number
end stringreal
get stringy : *
put stringreal (stringy (2 .. 4))
put stringreal (stringy (5 .. 7))
|
|
|
|
|
|
 |
MysticVegeta

|
Posted: Tue Mar 21, 2006 6:45 pm Post subject: (No subject) |
|
|
Huh? Where is the code? I cant see it!
|
|
|
|
|
 |
chrispminis

|
Posted: Tue Mar 21, 2006 8:20 pm Post subject: (No subject) |
|
|
Um, either you're insane or I am, but since you have the history of being mentally unstable in this thread, im assuming its you. I see it fine.
|
|
|
|
|
 |
MysticVegeta

|
Posted: Wed Mar 22, 2006 2:39 pm Post subject: (No subject) |
|
|
I am not joking, I cant see the attached file (if there is any)
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Clayton

|
Posted: Wed Mar 22, 2006 6:11 pm Post subject: (No subject) |
|
|
either:
1)ur insane
2)ur blind
3)ur dumb
4)ur being an idiot
5)the initial post has the entire program
6)3 posts above this there is the problem area of his coding (which i cant find out is wrong with it btw) which is causing the problem
|
|
|
|
|
 |
[Gandalf]

|
Posted: Wed Mar 22, 2006 6:16 pm Post subject: (No subject) |
|
|
Either you truly are insane, or else something is blocking it on your end, since it definately works.
As seen here:
|
|
|
|
|
 |
MysticVegeta

|
Posted: Wed Mar 22, 2006 6:40 pm Post subject: (No subject) |
|
|
Gandalf, I see the one you posted but I still cant see anything in his post. I am not idiot =\ but I am insane Honestly guys, I dont see that attachment
|
|
|
|
|
 |
Andy
|
Posted: Wed Mar 22, 2006 8:11 pm Post subject: (No subject) |
|
|
maybe chrispminis set an IQ filter so that people with IQ less than 110 arent allowed to look at his code
|
|
|
|
|
 |
Delos

|
Posted: Wed Mar 22, 2006 8:20 pm Post subject: (No subject) |
|
|
Then how can you see it dodge?
/me grins...then sidesteps as a series of defective Radeons are thrown at me.
|
|
|
|
|
 |
chrispminis

|
Posted: Wed Mar 22, 2006 10:45 pm Post subject: (No subject) |
|
|
Lol, well dont worry. It was stupid, i just forgot to set it back to zero
|
|
|
|
|
 |
MysticVegeta

|
Posted: Thu Mar 23, 2006 12:12 am Post subject: (No subject) |
|
|
Andy wrote: maybe chrispminis set an IQ filter so that people with IQ less than 110 arent allowed to look at his code God shalt punish you! Thou shalt not make fun of a person with reduced mental mobility.
Quote: Lol, well dont worry. It was stupid, i just forgot to set it back to zero
Ok, am i supposed to say it works now cuz it doesn't
|
|
|
|
|
 |
|