Forums › English Language Forums › General › General Discussion

Search

I figured out the maximum amount of crowns you can have

16 replies [Last post]
Mon, 08/18/2014 - 22:51
Abelisk's picture
Abelisk

While using the AH I noticed that the crowns can only go as high as 2 billion cr. Instead of 3 billion it goes to 300 million. Eventually by decoding the costs and what-not, I figured out the max. amount of cr is a very random number.

The max amount of crowns is 2,147,483,647. That's a lot of crowns.

Mon, 08/18/2014 - 22:59
#1
Flowchart's picture
Flowchart

it's not that random, it's because numbers in Java are typically 32 bits which means they are able to hold 2^32 different values.
But since they need 1 bit for sign (positive or negative) you get a range of -2^31 to 2^31-1 (which is the number you posted)

Tue, 08/19/2014 - 00:46
#2
Iapnez's picture
Iapnez
@Flowchart

Java uses two's complement, not the "one bit for sign" method. Don't take my word for it, take Oracle's word for it.

The int type is a 32 bit integer.
They could use a 64 bit long data type if they wanted to. With a long it could go to 9,223,372,036,854,775,807 crowns.

Tue, 08/19/2014 - 01:44
#3
Flowchart's picture
Flowchart

Yeah I know.. that's what I get for oversimplifying things
it's still a sign bit though

Tue, 08/19/2014 - 02:44
#4
Hyper-Galactic's picture
Hyper-Galactic
Hurr

Think of two's compliment as the low 31 bits minus the 32nd bit. The top bit set is negative 0x80000000. You add numbers to bring it up to zero. As a result, the number 0xffffffff is -1, and when you add another 1 to that the integer bits overflow to 0x00000000 zero. 0x7fffffff is the highest while 0x80000000 is the lowest value. A mathematical error occurs on the boundary of 0x7fffffff and 0x80000000, where the max wraps to minimum, if sk does this than deer god. That is flagged by the V flag in CPUs, while the -1 to 0 boundary is flagged by the C flag, a zero result flagged by the Z flag and the 32nd bit flagged by the N flag. These flags get checked by special jump instruction to represent those fancy if/else operations in code. And that there is how your generic twos compliment cpu implements logic.

Yer cpu boils down to a few boolean algebraic variables hard wired along with a few hard wired ints called a register set or register file. Along with ways to interrupt the program flow and switch out these algebraic variables with a parallel set for things like the kernel.

Tue, 08/19/2014 - 03:19
#5
Krakob's picture
Krakob

If we wanna include E in the equation, we could also assume it has the same cap. With a value of 75 CR/E, we'll take
2,147,483,647 * 75 = 161,061,273,525
161 billion CR if you store in E, in other words. Add the CR cap to that as well and you get 163 billion!

Tue, 08/19/2014 - 05:55
#6
Round-Shinigami's picture
Round-Shinigami
The real question is: how do

The real question is: how do you earn even half of the int limit, in other words: where to get a billion crowns? ^_O

Tue, 08/19/2014 - 06:53
#7
Arelic's picture
Arelic

Interestingly enough, this forum is not the only one in which I have seen THAT particular number being the limit for in-game currency. So it makes more sense now.

Tue, 08/19/2014 - 07:16
#8
Hyper-Galactic's picture
Hyper-Galactic
2147483647 + 1 == -2147483648

Question is, what happens if you're at that limit and you get 1 more cr? If they're not using a BigInt library than I wanna see the sparks fly. (>'-')>

And this kids, is why we have the CPU Carry flag, along with the ADC and SBC instructions in modern CPUs. Yay extendable integers

Tue, 08/19/2014 - 08:18
#9
Autofire's picture
Autofire
You are experiencing a PICNIC ERROR!

YES MATH!

@Hyper

I betcha that they have special code to handle overflow. However, I bet it has never really kicked in...

But that could be a new challenge! Who can get the limit first!?

Tue, 08/19/2014 - 08:35
#10
Krakob's picture
Krakob

Maybe I'm overestimating heavily but I think Nj could possibly reach the limit if he converted all his CE to CR.

Wed, 08/20/2014 - 04:56
#11
Hyper-Galactic's picture
Hyper-Galactic

Question is, does it wrap into negative, or does it just limit the crowns to maximum and forget the extra crowns gained? Other possibility/workaround is does it mail you the crowns past the int32 limit, and you can only accept the crown mail once your total crowns is below it? Or are they using a BigInt lib behind the scenes, but for what ever reason the input box was int32.

Wed, 08/20/2014 - 05:50
#12
Klipik-Forum's picture
Klipik-Forum

random fact, that's also the hp limit and damage limit on hearthstone cards.

Wed, 08/20/2014 - 12:17
#13
Fehzor's picture
Fehzor

There is the possibility that whatever data type was used to store our money can be worked around and extended when the limit is reached, so as to prevent any maximum amount. But honestly, that many crowns would be obscene to get without the use of some sort of exploit or administrative priveledge, so I kind of doubt that running over would be a problem.

Wed, 08/20/2014 - 12:42
#14
Jungle-Sword's picture
Jungle-Sword
To much math for me

seriously guys, Spiral knights is not about math, and to the challenge: I wonder who will be the first one.....

@krakky who is Nj?

Wed, 08/20/2014 - 12:45
#15
Crazee-Pi-Forum's picture
Crazee-Pi-Forum
Move over, there's bubble-wrap to be popped!

@Jungle-Sword Njthug, or if you're looking for more information, http://wiki.spiralknights.com/User:Njthug

Wed, 08/20/2014 - 12:44
#16
Mushy-Bucket's picture
Mushy-Bucket
@Jungle-Sword

Krakob was referring to Njthug, who is probably one of the (if not the most) richest players in SK.

Powered by Drupal, an open source content management system