Jump to content

Overflow protection


Recommended Posts

Hi,

I opened this thread :

Link

to discuss whether there should be poping up an error message when Autoit works with numbers greater than its limit.

Global Const $zahl1 = 132132132343242349898989898989834324234
$Vartype=VarGetType($zahl1)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Vartype = ' & $Vartype & @crlf);### Debug Console
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $zahl1 = ' & $zahl1 & @crlf);### Debug Console
Global Const $zahl2 = "132132132343242349898989898989834324234"
ConsoleWrite(StringLen($zahl1) & @CRLF)
ConsoleWrite(StringLen($zahl2) & @CRLF)oÝ÷ Ø­¢+ly鬶Þvçéz»-¢+l)¢´¸¤y«­¢+Ù5Í   ½à À°ÅÕ½ÐìüüüÅÕ½Ðì°ÌäíAÍÍèÌäìµÀìÌäìäääääääääääääääääääÌäìµÀì
I1µÀì|(ÌäíÍ¡½ÝèÌäìµÀìäääääääääääääääääää¤

But this can lead to unknown errors, cause Autoit seems to work with this huge numbers, but it doesn't and it doesn't show it to the user.

So my question is: is it normal that there isn't an overflow protection in languages like AutoIt?

Edit: Spelling

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

Link to comment
Share on other sites

Hi,

really nobody an opinion referring to the topic? Or do just have to wait? :)

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

Link to comment
Share on other sites

Hi,

haha :) , Germans are a bit better : German deficit

Although, this doesn't answer my question.

So my question is: is it normal that there isn't an overflow protection in languages like AutoIt?

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

Link to comment
Share on other sites

As far as I'm concerned, AutoIt's behavior is fine.

Hi,

hmmh ok. Maybe it is worth a sentence in the helpfile that huge numbers are reduced to the limit which Autoit can handle and that this may cause problems dealing with these huge numbers.

I do not know how other languages deal with this problem, but I'll have a look. Hopefully, Jon does the same. :)

(So this is works as designed)

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

Link to comment
Share on other sites

They are not reduced. Whichever bits happen to be set are set. It's like trying to fit 32-bits into 16-bits. Only part of it can be represented so however those bits end up is what the 16-bit value will end up being.

Link to comment
Share on other sites

They are not reduced. Whichever bits happen to be set are set. It's like trying to fit 32-bits into 16-bits. Only part of it can be represented so however those bits end up is what the 16-bit value will end up being.

Hi,

yeah I know what the problem is. (No need for pleonasm) :P

But I guess, there are systems which split the number to calculate higher numbers of something like that.

Anyway, I vote for documentation and everything is fine. :)

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

Link to comment
Share on other sites

HI,

I guess other languages treat it similar.

@Jon : What do you think?

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

Link to comment
Share on other sites

We are pretty much inheriting the behaviour from C++, which AutoIt is written in. In C++, integers silently roll-over during over-flow. If you want to keep the size of the number, but are willing to sacrifice some of the precision, put a decimal point on the end and turn it into a floating-point number.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

We are pretty much inheriting the behaviour from C++, which AutoIt is written in. In C++, integers silently roll-over during over-flow. If you want to keep the size of the number, but are willing to sacrifice some of the precision, put a decimal point on the end and turn it into a floating-point number.

Hi,

yeah I know about the tunring into negative values.

You mean like this:

Global Const $zahl1 = 9223372036854775800
Global Const $zahl2 = 9223372036854775800.00

For $i = 1 To 10 Step 1
    ConsoleWrite("---" & @CRLF)
    ConsoleWrite("Zahl1 :" & $zahl1 + $i & @CRLF)
    ConsoleWrite("Zahl2 :" & $zahl2 + $i & @CRLF)
    ConsoleWrite("Zahl3 :" & $zahl2 * $i & @CRLF)
Next

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...