Jump to content
Sign in to follow this  
Xenobiologist

Limit of StringLen and Numbers of Autoit?

Recommended Posts

Xenobiologist

Hi,

what is the limit of StringLen and what is the limit of Autoit calculating with numbers?

What does StringLen do with bumbers?

Global Const $zahl1 = 132132132343242349898989898989834324234
Global Const $zahl2 = "132132132343242349898989898989834324234"
ConsoleWrite(StringLen($zahl1) & @CRLF)
ConsoleWrite(StringLen($zahl2) & @CRLF)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

hmmh it is kind of strange to me. Maybe somebody knowing the func can explain it to me.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
DW1

The limitation isn't set by StringLen().

I think it is no numbers can be that big in autoit. <---- waiting to be proved wrong... probably by a penguin :)

Share this post


Link to post
Share on other sites
Paulie

The limitation isn't set by StringLen().

I think it is no numbers can be that big in autoit. <---- waiting to be proved wrong... probably by a penguin :)

15. What are the current technical limits of AutoIt v3?

...

Number range (integers): 64-bit signed integer

...

Share this post


Link to post
Share on other sites
Xandl

From help:

Maximum length of a single script line: 4,095

Maximum string length: 2,147,483,647 characters

Number range (floating point): 1.7E308 to 1.7E+308 with 15-digit precision

Number range (integers): 64-bit signed integer

Hexadecimal numbers: 32-bit signed integer (0x80000000 to 0x7FFFFFFF)

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Maximum depth of recursive function calls: 384 levels

Maximum number of variables in use at one time: No limit

Maximum number of user defined functions: No limit

Maximum number of GUI windows: 1024

Maximum number of GUI controls per window: 4096

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

:) I know the helpfile.

But if the number is greater than 19 digits, shouldn't there occur an error in lieu of returning 19?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
james3mg

Hi,

:) I know the helpfile.

But if the number is greater than 19 digits, shouldn't there occur an error in lieu of returning 19?

So long,

Mega

Gosh, was I confused when I posted.

Deleted.

Start over: it shouldn't return an error, because it can't hold a number that big to ever PASS to StringLen(), right? So maybe it truncates it to a number it can actually understand. Same thing if you try and String() the number...it can't pass that large a number to the String() function, so that doesn't work either.

I think you'd have to take the first 18 digits (to be safe), String() them, then take the next 18 digits, String them and append them to your first string, and so on until the end of the number...then run StringLen on that final string. Of course, that only works if you're getting that number from an external source (reading it, a database, etc), since AutoIt can't hold that large a number in the first place to break it apart.

Or just keep ignoring me...I don't really know what I'm talking about, I'm just speculating and thinking out loud :P

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites
DW1

That workaround still says 19... didn't change anything

EDIT: Damn penguins... I knew it.

Edited by danwilli

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

I'm not searching for a workaround. I just wanted to show that the behaviour is kind of weird, cause there is no exact answer from StringLen passing numbers greater then 19 digitis and there also no error appearing.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
james3mg

See my edit - my brain was elsewhere.

As an example, try this:

MsgBox(0,"hi",132132132343242349898989898989834324234)

I get 9223372036854775807, which is 111111111111111111111111111111111111111111111111111111111111111 in binary. So trying to use a number that long as a number will just get 'rounded' down to the largest possible number AI can hold...9223372036854775807

So it's not really an error - you've just filled up all of AutoIt's resources and it does the best it can. It doesn't understand larger numbers, so anything larger than 9223372036854775807 will be considered equivalant to it...since AutoIt's only looking at the first 64 bits to interpert a number.

There won't be an error, because the function isn't passed a number that's too big...it's passed the largest number AutoIt can understand. To be passed a number that's too big, AutoIt would have to be holding that number first.

But you're right - point well taken. It's weird, and one of those situations you don't expect that you'll have to test for manually.

..somehow.

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

yes. I have to search the helpfile for that. IMO this is totally wrong! If Autoit cannot handle the number it should return an error othwerwise I think all works well, but obviously it doesn't cause Autoit reduces the numbers to its limit.

So long,

Mega

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
james3mg

Hi,

yes. I have to search the helpfile for that. IMO this is totally wrong! If Autoit cannot handle the number it should return an error othwerwise I think all works well, but obviously it doesn't cause Autoit reduces the numbers to its limit.

So long,

Mega

That would be nice. But AutoIt doesn't think there IS a problem - it's just looking at the first 64 bits of a number, and working with those - it doesn't REALIZE there's anything above the 64th bit (speculation on my part).

Also, to what function would you have it return an @error?

$var=132132132343242349898989898989834324234
? That's when the 'error' actually occurs, but I know that I don't check for errors after a simple variable assignment!

Like I said, point taken, but I think that's the nature of computers, isn't it?


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites
DW1

I was just wondering the same thing... where would the error come from..... but maybe there should be a macro to see if there are any variables that were changed from what was originally requested. would be nice anyways.

Share this post


Link to post
Share on other sites
Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.