ID:309804
 
(See the best response by Popisfizzy.)
Code:
mob/var
maxhp = 2000000000 //2 billion
hp = 2000000000

mob/proc
Add_MaxHP()
switch(rand(1,3))
if(1)
src.hp-=rand(15000000,25000000)
src.maxhp+=rand(3000000,4500000)
if(src.hp<=0)
src.Die()
return
mob/verb
BeginAddingMaxHP()
usr.Add_MaxHP()
mob/Stat()
statpanel("Statistics")
stat("Max HP: [num2text(usr.maxhp,25)]")
stat("HP: [num2text(usr.hp,25)]")


Problem description:
Note: This is an example similar to the code used in my project, and is not the actual code used in my project.

The problem here is, after I get to about 2,000,000,000 maxhp, it stops adding on maxhp. But it does, however, take away the regular hp (like it is supposed to).
It works fine when it is 800,000,000 maxhp, 1.5 billion maxhp, etc. Once the character hits about 2 billion(ish), the adding stops, and I'm not sure if it has anything to do with Stat() or if it is something else. I simply have no idea what is causing it.

I would also like to let you know that a strange phenomenon happens when I directly edit the large number through a verb that allows me to edit it to any number I want.
For example, I edited my maxhp to 3,911,911,901.
After checking the statistics, the number became 3,911,911,936.

I don't understand this at all, and if anyone could assist me in understanding, it would be appreciated.
-JaiZo
Best response
This is because you're going past the point at which BYOND can accurately store integers.
Ah, so it is not a bug in my project but simply a lack of power of BYOND itself.
I suppose I will simply have to scale down the entire HP system in the project.

Thanks for the assistance, Popisfizzy.
-JaiZo
Useful information on numerical representation here
In response to JaiZo (#2)
It's physical and design problem.
You're doing something wrong if you need such numbers.
It is unfortunate, but why would you ever need numbers that large?