Code center > Bugs and fixes

Let's make a stable platform

<< < (11/26) > >>

Numsgil:

--- Quote ---CRASH:

Run-time error 6: overflow.

CODE:

rob(n).mem(refvelscalar) = Sqr(rob(n).mem(refvelup) ^ 2 + rob(n).mem(refveldx) ^ 2) ' how fast is this robot moving compared to me?

HOVERING INFO:

Hovering over first 'rob' as well as '.mem' displays 'rob(n).mem(refvelscalar) = 30509.

Hovering over all '(n)' variables in the code displays 'n= 176'.

Hovering over '(refvelscalar)' displays 'refvelscalar = 695'.

Hovering over next '(rob' as well as next '.mem' displays 'rob(n).mem(refvelup) = -21948'.

Hovering over '(refvelup)' displays 'refvelup = 699'.

Hovering over next 'rob as well as '.mem' displays 'rob(n)refveldx) = -30578'.

Hovering over '(refveldx)' displays 'refveldx = 697'.

Do I make any sence? Is this what you need?
--- End quote ---
Yeah, can you see why it would overflow?  If you do than you can be more useful bug hunting ;)

Testlund:
I have no idea! I know nothing about programming. Something wrong with the numbers, perhaps?

Numsgil:
Too bad...  Anyway yeah, all that info was helpful.

Botsareus:

--- Quote ---Too bad... Anyway yeah, all that info was helpful.
--- End quote ---
Not so too bad after all...

Private Sub Form_Load()
'aha we are working with intager
Dim a As Integer, b As Integer, c As Integer
'lets set the overflow frandly numbers for a spin
a = -21948
b = -30578
'ok now with the works
c = (a ^ 2 + b ^ 2) ^ 0.5 'can overflows for several reasons a.) trys to do a a ^ 2 in a integer memory range...

'ok now the same thing fixed:

c = CInt((CLng(a) ^ 2 + CLng(a) ^ 2) ^ 0.5)
Debug.Print c '31039

'Qustions? , comments? Send it over to microsoft.
End Sub

Testlund:
Here's another one for ya!

Same error 6 overflow.

Another code:

rob(n).mem(refvelup) = (rob(o).vx * Cos(rob(n).aim) + rob(o).vy * Sin(rob(n).aim) * -1) - rob(n).mem(velup)

Hovering info:

rob(n).mem(refvelup) = 14103

n = 403

refvelup = 699

rob(o).vx = 1370,617

o = 91

rob(n).aim = 3,747893

rob(o).vy = 95642,16

rob(n).mem(velup) = -5

velup = 200

Now I'm going to bed.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version