# Positive integer changing to negative integer

I have a coin counting system that uses a variable (integer) to count coins of varying denominations. When my score reaches 2,138,000,000 the score (coins) changes to a negative -2,138,000,000 and begins to subtract instead of add the value of each subsequent coin. How can I keep this from happening? Am I doing something wrong or is this a bug?
Thanks

I am new here but I will have a go. I believe this is called integer overflow, and it may be possible to solve by using an int64? The standard int is a 32 bit which can only contain values between -2,147,483,648 to +2,147,483,647

Using a float may also solve this issue

Yeah, Stwyford is right. When I don’t wanna use a float i just divide the number in multiple int values, like a string, this way 200,000,123 could be a string of 3 int values: 200, 000 and 123. That helps when you have compare nodes and so on.

Thanks,
I changed to a float and it acted the same way. Since it’s unlikely anyone will actually reach this high of a score, I won’t worry about it.
Thank you both.

Yes, Stwyford is correct, the maximum value of any signed int 32 (which is what UE4 uses in blueprints) is 2,147,483,647. The maximum value of an int 64 is 9,223,372,036,854,775,807, however, this is only available using c++. If your player is collecting that many coins I would imagine they would be playing this game for quite a long time. I doubt anyone would ever achieve a score like that!