I need more bytes

Blitz3D Forums/Blitz3D Programming/I need more bytes

Whats My Face(Posted 2009) [#1]
what happens when I want to have a number that's bigger than 2147483647. Is there any way of doing that in Blitz?


Yasha(Posted 2009) [#2]
Not if you want the code to be executed quickly, but it is possible to use strings or banks to store arbitrary-precision numbers. Try this - http://www.blitzbasic.com/codearcs/codearcs.php?code=2030 .


Whats My Face(Posted 2009) [#3]
To explain my problem further (maybe I don't need more bytes and there's a different way to do this) I know the dotted IP of a server but need to have it in integer form (because that's what UDP likes for some reason). I have the formula to do this but sometimes the number is greater than an integer can hold.

And how do you use that code above; I looked at it and was stumped.


Gabriel(Posted 2009) [#4]
To explain my problem further (maybe I don't need more bytes and there's a different way to do this) I know the dotted IP of a server but need to have it in integer form (because that's what UDP likes for some reason). I have the formula to do this but sometimes the number is greater than an integer can hold.

I think you're confused. An IPV4 dotted IP has four values between 0 and 255. So four bytes. And a Blitz3D integer is 32 bit. So four bytes. The fact that integers can't be above 2 billion doesn't mean that data is being lost, it just means that Blitz3D uses the first bit to determine the sign of the value. There are still 4 billion combinations, they just appear different when printed. The data is still the same, it's purely an aesthetic difference.


Whats My Face(Posted 2009) [#5]
Oh, thanks Gabriel. I got the code working.