Ubasic maximum constant

  • 1 Replies
  • 649 Views
*

Offline ozcar

  • *
  • 13
Ubasic maximum constant
« on: 10 / June / 2015, 02:28:38 »
Advertisements
Writing my first, and so far only script, and I encountered a "parse error" which I think is due to the fact that constants in Ubasic can be 6 digits at most. Maybe "everybody" just knows this, because I had trouble finding a definitive statement.

In this page, http://chdk.wikia.com/wiki/UBASIC/uBASIC_syntax  it says variables are 32 bit unsigned integers, but says nothing about some additional restriction.

I also turned this up: http://images2.wikia.nocookie.net/__cb20100806022158/chdk/images/e/e5/UBASIC_User_Guide_D0_5.pdf
where it expands on the "32 bit signed integer" with:

"However, due to a bug in the current main release, values greater than 6 decimal digits cannot be assigned (i.e. 999,999 is the current maximum decimal value) – DF."

I'm not sure that is strictly correct, as it seems you can "assign" greater values provided you are in the know and a bit devious. If you wanted say x=9999999 (seven digits), x=2151*4649 should work.

Also, is this limitation really a bug? Has somebody actually tried increasing MAX_NUMLEN and found that something really bad happens?

*

Offline reyalp

  • ******
  • 11392
Re: Ubasic maximum constant
« Reply #1 on: 10 / June / 2015, 16:26:36 »
I'd suggest using Lua if that limit is an issue in your script.
Don't forget what the H stands for.

 

Related Topics