Noting the
published Ranges for Integers and Reals:
INTEGER Range : -2,147,483,648 to 2,147,483,647
REAL Range : 3.4E +/- 38 (7 significant figures)
...i wanted to see what would happen if i (mis?)used datatypes while setting sprite position:
SetWindowSize( 800,600, 0 )
Max = 2147483647
CurrentX = Max
This = CreateSprite(0)
SetSpritePosition(This,CurrentX,0)
MaxX = 0 : MinX = 0
do
CurrentX = CurrentX - 1
SetSpritePosition(This,CurrentX,0)
ThisX# = GetSpriteX(This)
ThisX = GetSpriteX(This)
DiffX = CurrentX-ThisX
If DiffX < MinX then MinX = DiffX
if DiffX > MaxX then MaxX = DiffX
Print("CX: " + STR(CurrentX))
Print("X#: " + STR(ThisX#))
Print("SX: " + STR(ThisX))
Print("=" + STR(DiffX))
print("Max: " + STR(MaxX))
Print("Min: " + STR(MinX))
Sync()
loop
running that, you'll see that the DiffX between CurrentX and SpriteX varies by a consistent +-64.
Then, if using CurrentX = CurrentX
+1, instead, it reaches 2147483648, or 1 more than the Max (i think i saw a thread on this recently?) before it wraps to
-2147483647 and continues adding.
This is (i believe) trivial but i am curious. Can anyone shed some light?
BTW, what brought me here is the question of sprite placement limits. IE, if i want to (
conventionally) represent "space", how far can my ship travel?