Jump to content

Help me! three qeustions here dealing with the max gp...


zeldan

Recommended Posts

answer these questions for me and ill love ya fer life :)

 

 

 

 

 

 

 

1. What is the maximum amount of money any rs player can have (must be exact)

 

 

 

 

 

 

 

2. Why is that number the maximum amount?

 

 

 

 

 

 

 

3. what happens if you have that amount and try to add more money?

 

 

 

 

 

 

 

i needa know these answers plz :)

Link to comment
Share on other sites

1) Unknown at present - there have been players with billions in their account 1,000,000,000 - i am told it shows in the account as 1,000 mil (or m - i forget)

 

 

 

 

 

 

 

2) As above

 

 

 

 

 

 

 

3) The counter flicks over - if the field on the database they store it in is signed it shows as 0 on your screen, if unsigned you get a very large negative number :twisted:

 

 

 

 

 

 

 

Now answer one

 

 

 

 

 

 

 

Why do you need to know?

vlad_the_old.jpeg

Thanks to 4be2jue for the sigs.

 

Vlad_The_Old.png

There are 10 types of people in the world - those that understand binary and those that don't!

Vlad_the_old.png

Link to comment
Share on other sites

Well in that case it may be the maximum you can store in a register / double word - thats 16 bytes - would be FFFF FFFF FFFF FFFF in hexidicimal so that would be 18,446,744,073,709,551,605.

 

 

 

 

 

 

 

If they were just using a single word (4 bytres) the maximum would be 4,294,967,295.

 

 

 

 

 

 

 

Obviously these are the miximum values that can be held in a field of that length - if the field was signed the maximum would be roughly halved.

 

 

 

 

 

 

 

*Edit*

 

 

 

It was late when I wrote this and just spotted an error.

 

 

 

 

 

 

 

A word is 2 bytes long and a double word / register is 4 bytes. the 16 byte field is different and is to do more with mainframes.

vlad_the_old.jpeg

Thanks to 4be2jue for the sigs.

 

Vlad_The_Old.png

There are 10 types of people in the world - those that understand binary and those that don't!

Vlad_the_old.png

Link to comment
Share on other sites

 

um, ?

 

 

 

I still say 2.1B :D

 

 

 

 

 

 

 

Roughly half of 4,294,967,295, which is 11111111111111111111111111111111 in binary.

 

 

 

 

 

 

 

:lol:

 

 

 

 

 

 

 

2,147 mil (2,147,483,647)

 

 

 

 

 

 

 

7F FF FF FF in hex

 

 

 

 

 

 

 

And yes - it is that in binary :thumbsup:

 

 

 

 

 

 

 

The next number 80 00 00 00 is minus 1 but any decent coder would have checked and stopped that happening.

vlad_the_old.jpeg

Thanks to 4be2jue for the sigs.

 

Vlad_The_Old.png

There are 10 types of people in the world - those that understand binary and those that don't!

Vlad_the_old.png

Link to comment
Share on other sites

You're welcome? :-s

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BTW, to all Admins and Mods, I ask that this thread be made a sticky... This question has been asked so many times while I have been here that it is not funny anymore to have thread upon thread show up. So, PLEASE, sticky it? :pray:

 

 

 

 

 

 

 

 

 

 

 

~Mr. Devnull

tifuserbar-dsavi_x4.jpg and normally with a cool mind.

(Warning: This user can be VERY confusing to some people... And talks in 3rd person for the timebeing due to how insane they are... Sometimes even to themself.)

Link to comment
Share on other sites

Fields that they use to accumulate values are probably integer fields and these have a maximum length of 4 bytes.

 

 

 

 

 

 

 

Stepping back a bitÃÆââââ¬Å¡Ã¬Ãâæ

 

 

 

 

 

 

 

Computers work in binary so can accept a value of 0 or 1.

 

 

 

 

 

 

 

Each character you see is a byte and these are made up of 8 bits so the number 8 you see on your screen is 00001000 in binary which is represented as 38 in Hexadecimal (I am talking ASCII characters here not EBCIDIC).

 

 

 

 

 

 

 

So back to our integer field ÃÆââââ¬Å¡Ã¬Ã¢ââ¬Ãâ this has a maximum value of 4,294,967,295 shown as FFFF FFFF in hexadecimal or 11111111111111111111111111111111 in binary.

 

 

 

 

 

 

 

This maximum value is unsigned i.e. we do not know if it is a + or a minus.

 

 

 

 

 

 

 

In order to get around this the high order bit (that is the 1 at the far left), is designated as the one that will determine if the field is positive or negative (0 = + 1 = - ) This means the maximum value that can be stored is halved as now FFFF FFFF represents

 

 

 

-2,147,483,647 and 7FFF FFFF is +2,147,483,647.

 

 

 

 

 

 

 

So back to binary and +2,147,483,647 is shown as 01111111111111111111111111111111. If 1 is added to this we get 10000000000000000000000000000000. As the high order bit has been switched and we are treating the field as signed the value is not +2,147,483,648 it is ÃÆââââ¬Å¡Ã¬Ã¢ââ¬Ãâ1 (could be ÃÆââââ¬Å¡Ã¬Ã¢ââ¬Ãâ0,been a while since I played with this but you get my point).

 

 

 

 

 

 

 

Here ends lesson 101 in computing ÃÆââââ¬Å¡Ã¬Ã¢ââ¬Ãâ and I think you will find the answers to all 3 questions contained in there. :wink:

vlad_the_old.jpeg

Thanks to 4be2jue for the sigs.

 

Vlad_The_Old.png

There are 10 types of people in the world - those that understand binary and those that don't!

Vlad_the_old.png

Link to comment
Share on other sites

In 2-complement 10000000000000000000000000000000 is actually

 

 

 

-2,147,483,648 and 11111111111111111111111111111111 is -1.

 

 

 

 

 

 

 

If you add 1 to 11111111111111111111111111111111 you get a so called overflow which is not really a problem in this system since the next number is 00000000000000000000000000000000 which represents 0.

Link to comment
Share on other sites

In 2-complement 10000000000000000000000000000000 is actually

 

 

 

-2,147,483,648 and 11111111111111111111111111111111 is -1.

 

 

 

 

 

 

 

If you add 1 to 11111111111111111111111111111111 you get a so called overflow which is not really a problem in this system since the next number is 00000000000000000000000000000000 which represents 0.

 

 

 

 

 

 

 

Thanks for that. As I said, been a while since I played around at this low a level. :oops:

vlad_the_old.jpeg

Thanks to 4be2jue for the sigs.

 

Vlad_The_Old.png

There are 10 types of people in the world - those that understand binary and those that don't!

Vlad_the_old.png

Link to comment
Share on other sites

lol are you all math genies like FFFF FFFF=*put the right cypher here*

 

 

 

and 1111111111111=*put right cypher here*?

 

 

 

 

 

 

 

Actually, they're trying they're best to give a dumbed-down explanation of "computer-binary-ese" language... Sadly, being a tech wacko myself, that's something that I know is kinda hard to do! :oops: :(

 

 

 

 

 

 

 

~Mr. Devnull

 

 

 

 

 

 

 

(STILL REQUESTING THREAD STICKY!!!)

tifuserbar-dsavi_x4.jpg and normally with a cool mind.

(Warning: This user can be VERY confusing to some people... And talks in 3rd person for the timebeing due to how insane they are... Sometimes even to themself.)

Link to comment
Share on other sites

1. What is the maximum amount of money any rs player can have (must be exact)

 

 

 

(2^31)-1

 

 

 

2,147,483,647

 

 

 

 

 

 

 

2. Why is that number the maximum amount?

 

 

 

Because a signed, 32 bit number is what RS uses.

 

 

 

 

 

 

 

3. what happens if you have that amount and try to add more money?

 

 

 

It depends on how the Jagex complier of Runescipt handles signed overflow errors.

 

 

 

Generally speaking, either it will crash or "overflow" to a large negative number.

 

 

 

 

 

 

 

If you were working with a 4 bit signed number, you could represent numbers from -8 to +7

 

 

 

So, if you had +7 and added 1 to it (0111 + 0001) you would get 1000

 

 

 

in binary which is -8 in the number scheme used.

 

 

 

That may or may not be noticed by the system.

 

 

 

 

 

 

 

Consider what happens on old cars when they pass 99999 miles.

 

 

 

The odometer rolls over to start back at 0.

 

 

 

(The car that I ride in has already done that twice!)

 

 

 

 

 

 

 

Another example, I had a Monopoly program that I used to play against.

 

 

 

The max number used was 2^15-1 (32767)

 

 

 

So I managed to get $32000 in my bank and then the computer landed

 

 

 

on my Boardwalk full of Hotels and had to pay me $2000.

 

 

 

So my total cash was $32000+$2000 = $34000

 

 

 

That is greater than 32767 and "signed overflowed" the number to -31536

 

 

 

At that point that computer saw that I was "bankrupt" and promptly declared itself the winner! #-o

 

 

 

Lol

 

 

 

 

 

 

 

Hope this helps

Link to comment
Share on other sites

wow i came here to find out the max money and got a headache

Sirscrap.png

 

Click sig for blog ^^

 

6,627th to 99 fletching

33,986th to 99 attack

4,871st to 99 thieving

 

Whip drops: 28 / Dark Bows: 7 / Hexcrests: 7 / Focus Sights: 1 / Staffs of Light: 6 / Dragon Chainbodies: 2 (1 KQ Solo 1 Dust Devil)

Link to comment
Share on other sites

Another example, I had a Monopoly program that I used to play against.

 

 

 

The max number used was 2^15-1 (32767)

 

 

 

So I managed to get $32000 in my bank and then the computer landed

 

 

 

on my Boardwalk full of Hotels and had to pay me $2000.

 

 

 

So my total cash was $32000+$2000 = $34000

 

 

 

That is greater than 32767 and "signed overflowed" the number to -31536

 

 

 

At that point that computer saw that I was "bankrupt" and promptly declared itself the winner! #-o

 

 

 

Lol

 

 

 

I always thought the computer cheated. <.< Thanks for the Proof. :D

 

 

 

 

 

 

 

~Mr. Devnull

tifuserbar-dsavi_x4.jpg and normally with a cool mind.

(Warning: This user can be VERY confusing to some people... And talks in 3rd person for the timebeing due to how insane they are... Sometimes even to themself.)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.