ID:144430
![]() Dec 8 2006, 7:41 am
|
|
What's the highest possible value that Byond can track, signed and unsigned?
|
![]() Dec 8 2006, 7:42 am (Edited on Dec 8 2006, 7:48 am)
|
|
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).
|
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 |
Oops, you are right, my tests give me 1.67772e+007 on additoon and multiplication gives me 2.5521177519070385e+038.
|
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 |
Yeah my test gives me 2.5521177519070385e+038. But I get the 3.4e38 in C++.
mob Is there a way we can have long double numbers? |
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 |
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 |