Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Math is kinda simple, once you know how a number is stored in a computer memory.
It looks like this number is a signed long.
Signed means the values can range from before and after zero (negative numbers as well as positive).
And long means a big integer, which means a big number. So the devs thought they would need a big number. Good. But not good enough, you will see later why.
A signed long is 4 bytes. 1 byte is 8 bits. A bit is a 0 (zero) or 1 value.
So it's like a 32 bits lenght number.
With 32 bits you got something like this:
0000 0000 0000 0000 0000 0000 0000 0000
It should be 32 zeros.
And this can range from all these zeros above, to a full value like this:
1111 1111 1111 1111 1111 1111 1111 1111
32 ones.
This will represent all the possible values, hence the max value that can be reached.
Which is (2^31) - 1 = 2,147,483,647
Why the power 31 and not 32 ?
Because you need one bit to tell if the number is positive or negative.
Yep, this wastes 1 bit for that.
Why the -1 ?
Because here we count the 0 (zero) value.
An unsigned long would have been able to hold one more bit. Which is what the devs should have done since a score is rarely (never) negative.
With an unsigned long we would have been able to double the max score up to 4,294,967,295.
A little bit more challenging right?
I'm pretty sure you got the explenaitions mixed up, there are 2^32 possibilities half of which are used for negative numbers which leaves 2^31 possibilities for positive numbers which you could then use to count to 2^31 - 1 if you start counting at 0. Makes you wonder why they didn't use an unsigned integer, it's not as if they need to be able to record negative scores.
Guess you are right. The -1 is just cuz we start at 0. The ^31 instead of ^32 is the negative sign.
Yep I mixed the explanations