# Handling Big Numbers

M

#### Mason2121

##### Guest
Hello reader, I am currently making an incremental idle game with Game Maker Pro (Mac) I have come upon a problem where once a value reaches 2 billion or so, the object that is assigned to draw the value on screen gives us a negative number. For example, if your money is at 3 billion, it will show up that you have -1.4312235 billion money. I went to debug mode to see if it was a problem with the actual value, but it would show up as 3 billion perfectly fine there. I don't know if it is a drawing problem or a scripting problem, but I need help to continue developing my game.

I've also downloaded GM-GMP from http://www.maartenbaert.be/game-maker-dlls/gm-gmp/ . I don't have much of an idea on how to use it, so any help on this would be appreciated.

#### Jrtllion

##### Member
this is your problem, a real value in game maker is a signed 32 bit integer, the limit is just over 2 billion. There area a couple ways to handle this, such as the int64() function which will bring your limit to something like 9,223,372,036,854,775,807 (don't quote me on that, I jsut did a quick gogole search) . Very useful information can be found in this post which lists the limits and issues with using int64. There are many ways to handle the issue, but this is one of the easier.

2,147,483,647

The number 2,147,483,647 (or hexadecimal 7FFF,FFFF16) is the maximum positive value for a 32-bit signed binary integer in computing. It is therefore the maximum value for variables declared as integers (e.g., as int ) in many programming languages, and the maximum possible score, money, etc. for many video games.

GMC Elder

#### JFitch

##### Member
You could split the number into parts. For example, you could separate the billions and the ones into two separate variables.

if money_ones>=1000000000
{
money_ones-=1000000000
money_billions+=1
}
if ones<0
{
money_ones+=1000000000
money_billions-=1
}

when drawing the money, you can draw:

string_format(money_billions,0,0)+string_replace_all(string_format(money_ones,9,0)," ","0")