LB Booster
« "Number Too Big" error »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:52am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: "Number Too Big" error  (Read 720 times)
tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: "Number Too Big" error
« Reply #4 on: Apr 13th, 2015, 9:32pm »

wait - does LBB has non-blocking INPUT$(1)?
does it documented somewhere?
Code:
timer 100, [back]
[back]
print time$("ms")
scan
i$=input$(1): if asc(i$)<>13 then goto [back]
timer 0
print "Enter pressed"
end
 

*falls off chair*
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: "Number Too Big" error
« Reply #5 on: Apr 13th, 2015, 9:54pm »

on Apr 13th, 2015, 8:11pm, Monkfish wrote:
No, I am using LBB version 2.82

So please upgrade. I can only provide support for v3.00.

Quote:
Yes 175600 is the line number. Old habits die hard.

So are you using GOTOs or GOSUBs to line numbers? Although that works in LBB it's not a feature that is extensively tested because it's rarely used (and it's slow compared with using labels).

Quote:
It's the only way I could think of to confirm I had the right line.

If it said 'at line 823' that's the actual line in your source program where the error happened, so you need only page down and move the cursor (caret) until that number is displayed in the status bar. In v3.00 it's even easier: bring up the Goto Line dialog (e.g. Ctrl+G) and type in 823.

Quote:
Here is the timer code:
Code:
timer 100, [cont]
[back]
i$=input$(1): if asc(i$)<>13 then goto [back]
timer 0: goto [Enter_Pressed] 

It's a bit unusual but I can't see any obvious reason why it wouldn't work.

Edit: Anatoly has rightly identified a potential problem with this code, so it ought to be changed to use INPUT rather than INPUT$(1).

Richard.
« Last Edit: Apr 13th, 2015, 10:49pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: "Number Too Big" error
« Reply #6 on: Apr 13th, 2015, 10:46pm »

on Apr 13th, 2015, 9:32pm, tsh73 wrote:
wait - does LBB has non-blocking INPUT$(1)?

It works the same as the regular INPUT statement: it blocks but internally does a SCAN so can be interrupted by a TIMER or GUI event.

However in the case of INPUT$(1) that feature is really only intended to be used with a SUB handler. Using a label as the TIMER handler is risky because it may cause a jump out of the expression evaluator.

Maybe that is indeed the cause of the OP's problem. As he is trying to detect the Enter key being pressed a regular INPUT should work just as well, and is safer:

Code:
timer 100, [cont]
[back]
input i$
timer 0: goto [Enter_Pressed]
[cont]
timer 0: goto [Continue] 

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: "Number Too Big" error
« Reply #7 on: Apr 14th, 2015, 9:51pm »

Thanks for all your help guys. I am now using V3.00 and have done what you suggested. I haven't seen the error again, so cross fingers smiley

Richard, when you said that line numbers are slower what did you mean exactly? I thought line numbers were viewed by the compiler like labels... just that every line has a label. Will it actually make my program slower?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: "Number Too Big" error
« Reply #8 on: Apr 14th, 2015, 10:45pm »

on Apr 14th, 2015, 9:51pm, Monkfish wrote:
I thought line numbers were viewed by the compiler like labels... just that every line has a label. Will it actually make my program slower?

It can, yes (in LBB; I can't speak for LB). It all depends on where the line you are jumping to is. If it's near the beginning of the program then using a line number may be no slower than a label (it may even be faster) but the further into the program the destination is, the slower using a line number will become. With a label the location of the destination makes little difference to the speed.

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: "Number Too Big" error
« Reply #9 on: Apr 15th, 2015, 07:58am »

Oh, thanks Richard, I didn't know that. Clearly I need to go to programming Boot Camp! wink
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls