Computing desk | ||
---|---|---|
< October 4 | << Sep | October | Nov >> | Current desk > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
As the title says, I get an error message when trying to assign that number to an int or even a long. How do I get around this? I'm not even sure if I should be getting this error as I don't think the number is that big. -- Polyknot ( talk) 11:49, 5 October 2018 (UTC)
int
is 32 bits, hence its range is −2,147,483,648 to 2,147,483,647. You may try a 64-bit long
for values up to 9,223,372,036,854,775,807. --
CiaPan (
talk) 11:57, 5 October 2018 (UTC)
L
at the end of the constant, like this: 600851475143L
, to indicate it is long
? --
CiaPan (
talk) 12:31, 5 October 2018 (UTC)if (your_number == 0) do_nothing;
I recall a parody non interactive "RPG" which worked on telnet (probably). Essentially you made a connection to the server and something like this happened:
...
>You hit the imp.
>The imp misses you.
>You defeat the imp.
>You gained 2xp.
>You are now level 2.
>You attack a brownie.
...
Essentially the longer you stayed connected, the higher level (and the more bored) you got. Naturally people had connected unattended telent sessions, some of them running for months or maybe years - there was a leader-board. If you disconnected, you had to restart from zero.
Anyone remember the name, location and know if it still exists?
All the best:
Rich
Farmbrough, 13:36, 5 October 2018 (UTC).
Computing desk | ||
---|---|---|
< October 4 | << Sep | October | Nov >> | Current desk > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
As the title says, I get an error message when trying to assign that number to an int or even a long. How do I get around this? I'm not even sure if I should be getting this error as I don't think the number is that big. -- Polyknot ( talk) 11:49, 5 October 2018 (UTC)
int
is 32 bits, hence its range is −2,147,483,648 to 2,147,483,647. You may try a 64-bit long
for values up to 9,223,372,036,854,775,807. --
CiaPan (
talk) 11:57, 5 October 2018 (UTC)
L
at the end of the constant, like this: 600851475143L
, to indicate it is long
? --
CiaPan (
talk) 12:31, 5 October 2018 (UTC)if (your_number == 0) do_nothing;
I recall a parody non interactive "RPG" which worked on telnet (probably). Essentially you made a connection to the server and something like this happened:
...
>You hit the imp.
>The imp misses you.
>You defeat the imp.
>You gained 2xp.
>You are now level 2.
>You attack a brownie.
...
Essentially the longer you stayed connected, the higher level (and the more bored) you got. Naturally people had connected unattended telent sessions, some of them running for months or maybe years - there was a leader-board. If you disconnected, you had to restart from zero.
Anyone remember the name, location and know if it still exists?
All the best:
Rich
Farmbrough, 13:36, 5 October 2018 (UTC).