Jump to content

Recommended Posts

Posted

Is Biginteger possible with AutoIt:

Something like this:

a=12345234532453454576357673567463245342635525324534567890

b=2323453245234532454352452352352345235354567

[...]

a/b=5313313085930

a%b=2287874721508099322718185501018800045625580

Posted

Welcome to the forums!

Currently this functionality is not available. It would be possible to program some AutoIt code to manipulate such large numbers to an extent though (where they can be handled as a string -- e.g. addition, subtraction and modulus are easy because they can be done on a digit-by-digit basis).

  • 5 months later...
  • Moderators
Posted

Can anybody post a examples or DLL to import?

Um... a bit to much to drink tonite? What does your question have to do with this topic, and if it does have to do with this topic, why weren't you more specific on what you wanted? And if your the original poster, what's up with the different name? And since I'm asking so many questions, why aren't I in bed?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Can anybody post a examples or DLL to import?

Here's an example to add big integers stored in string format. It only works for positive integers (unexpected results will occur if the strings contain anything other than digits).

Local $A = '12345234532453454576357673567463245342635525324534567890'
Local $B = '2323453245234532454352452352352345235354567'
MsgBox(0, "$A + $B", Add($A, $B))

Func Add($1, $2)
    Local $Output = ''
    Local $DigitSum = 0
    While $1 <> '' Or $2 <> ''
        $DigitSum += StringRight($1, 1) + StringRight($2, 1)
        $Output = Mod($DigitSum, 10) & $Output
        $DigitSum = Int($DigitSum / 10)
        $1 = StringTrimRight($1, 1)
        $2 = StringTrimRight($2, 1)
    WEnd
    If $DigitSum Then $Output = $DigitSum & $Output
    Return $Output
EndFunc

It's not the most efficient code but it proves that it's possible.

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
  • Recently Browsing   0 members

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