Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Max number in agk 999,999,999?

Author
Message
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 10th May 2023 04:49
i reworked a function i found someone had posted her in the forum so that i coud add prefixes at the end of my numbers instead of a large number taking up the screen, I cant seem to get any number larger than 999999999 to work properly though.

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th May 2023 07:26 Edited at: 10th May 2023 07:45
Largest signed integer is 2,147,483,647
Maybe try this;
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 10th May 2023 09:31
Physically you cannot have a number above 4.26 Billion (32-bit Limitation)
Practically speaking, it can't be above 2.14 Billion (Signed Limitation)

This is as a note why using Integers will result in the limitation of 1,000,000,000 being "Accurate" because you can't really store a number that would be the next group size up.
With this said, there are ways around this.

If we were to template a class:



We can store the "Physical" Value in a String., as we can have up to 4096 Characters (16kB) per String.
For actually working with said number we can break it down into the 1,000 Block Groups., meaning that each of our Groups is 0 - 999...
This then allows us to use an Adder Carraige Return Method of Mathematics.

That is to say that we process mathematics on each Group.
For Addition we work from Smallest to Largest., thus Remainders from each Group are Added to the Next Group and/or a Group is Added until we no longer have any Groups left to process.
For Subtract we work from Largest to Smallest, thus Remainders are Subtracted from the Next Group until we are at the 0 Group., then we ignore the Result.

Multiplication and Division might seem more complicated but they're not., as they are just Addition and Subtraction with Multiple-Passes.
see: Full-Adder for more details on how to handle this

In this regard you can handle MUCH larger values., because what you're doing is breaking down the problem into smaller problems to solve.
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 10th May 2023 18:26
thank you both for responding. Raven im interested in this full adder method but im only finding that term in terms of circuitry .
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th May 2023 23:43 Edited at: 10th May 2023 23:49
Maybe have a look at this. If it doesn't work for you then maybe MadBit could add it to his File Explore plugin

Also I am positive someon has written routines to manage large numbers but I cannot seem to find the thread...Found it!!
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 12th May 2023 16:24 Edited at: 12th May 2023 18:00
So im trying to do my own little function here thats partly working. the idea is to save the integers as strings within an array each of up to 1000000000
im getting it to add to the first one then create another in its at 1000000000 but it seems to be adding the whole remaining amount to the created length when it should be only going to 1000000000 then making another if needed

edit : i have figured it out! now im one step closer to managing large token numbers!

also eventually i will have incoming amounts that are higher then 1000000000 so next i need to figure out how to break that down into smaller strings then "do math" with the current tokennums
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 13th May 2023 05:53 Edited at: 3rd Jun 2023 13:49
if anyone is interested i did work out a way to at least add numbers and subtract numbers larger than 2,147,483,647 by using strings im sure it can be improved upon but let me know what you think

Login to post a reply

Server time is: 2024-03-29 09:53:58
Your offset time is: 2024-03-29 09:53:58