ID:144430
 
What's the highest possible value that Byond can track, signed and unsigned?
If you do addition they are an 32 bit int(-2,147,483.647 to 2,147,483.647), and multiplication and divison they are a float(1.2e-38 to 3.4e38).
In response to Xx Dark Wizard xX
And bitwise operations are limited to 16 bits (65,535 decimal).
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
If you do addition they are an 32 bit int(-2,147,483.647 to 2,147,483.647), and multiplication and divison they are a float(1.2e-38 to 3.4e38).

Wrong on the first part. All BYOND numbers are floats. As such they have only 24 bits of precision. The highest integer value you can keep track of therefore is 16777216, and the lowest is its negative.

Lummox JR
In response to Lummox JR
Oops, you are right, my tests give me 1.67772e+007 on additoon and multiplication gives me 2.5521177519070385e+038.
In response to Xx Dark Wizard xX
So how do some games keep track of values far above this number?
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
Oops, you are right, my tests give me 1.67772e+007 on additoon and multiplication gives me 5.03316e+007. Why when I program the test in C++ I get a very much larger number and I'm using float.

Regular single-precision floats will only allow you an integer of at most 224. After that addition will fail you miserably. Multiplication however should work up to the highest possible floating point number, which I believe is around the 1038 range you mentioned.

Lummox JR
In response to Lummox JR
Yeah my test gives me 2.5521177519070385e+038. But I get the 3.4e38 in C++.
mob
verb
Check()
var N = 2
var N2 =2
do
N*=2
N2*=2
usr<<"[num2text(N,100000)]"
while(++N != N2)

Is there a way we can have long double numbers?
In response to Cheeseburgermafia
Cheeseburgermafia wrote:
So how do some games keep track of values far above this number?

I know of none that currently do. However they could always use a text string.

Lummox JR
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
Yeah my test gives me 2.5521177519070385e+038. But I get the 3.4e38 in C++.

Most likely reason: You're not actually reaching the highest number. The highest number isn't a direct power of 2, but rather has a mantissa full of binary 1's.

Is there a way we can have long double numbers?

Not in BYOND, no. In fact even C++ won't do it if you're using Microsoft Visual C++. To use long doubles you actually have to use inline assembly.

Lummox JR