The weekly newsletter for Fed2
by ibgames

EARTHDATE: April 29, 2012

Official News page 3


WHY ARE BALANCES CAPPED AT 2 GIG?

by Hazed

Last week I told you that cartel treasuries are now capped at 2 gigagroats. This brings them in line with other balances such as your personal bank balance, and planet treasuries, all of which have similar limits.

But why?

Well, it’s technical, to do with the way that computer programs handle numbers.

You see, computers don’t have fingers so they have no need to count in groups of ten like humans do. For a thorough explanation, though, we should turn to Alan who has this to say:

Numbers in the computer on which Fed runs are stored in zeros and ones. This is because the memory is a large collection of transistors, each of which can be on (a one) or off (a zero). Counting in twos is known as binary and each zero or one is known as a bit. Balances in Fed are stored as signed integers. An integer takes up 32 bits, but because it needs some way to say whether the number is positive or negative, the computer looks at the highest bit to find out what the sign of the number is. If it's a zero the number is positive, if it's a one the number is negative.

This means that there are only 31 bits left to give the value of the number, so the largest number is 2 to the power 31 = 2,147,483,647 represented by the binary number 0111 1111 1111 1111 1111 1111 1111 1111. If we add two (binary 0000 0000 0000 0000 0000 0000 00000 0010) to this number it becomes 1000 0000 0000 0000 0000 0000 00000 0001. The one is now set on the left hand end (the top bit) so the computer will treat the number as a negative number, and since the only other bit set is the lowest one, the computer interprets the result of 2,147,483,647 + 2 as being -1. If you had added an even larger number, which is what most people do when they are dealing with company and planetary balances, you would see an even larger negative number!

Actually, the computer architecture and the specific way in which things are stored may be slightly different with different computers, but this is essentially what happens when you get what we in the trade call a numeric overflow. Actually, stopping it from happening is not as easy as it looks, but I'll leave that as an exercise to the reader :)

So now you know...


Fed2 Star index Previous issues Fed 2 home page