|
-
Nov 6th, 2002, 09:29 PM
#1
Thread Starter
New Member
For loop Overflowing
well, i have this code:
For lngCounter = 0 To lngNumberResources - 1
Get #1, lngOffsetResources + 11 + (lngCounter * 14), ArrBytWOWTempArray1()
ArrDblResources(lngCounter) = ArrBytWOWTempArray1(0) * ArrBytWOWTempArray1(1)
ArrDblResourcesBIFF(lngCounter) = ArrBytWOWTempArray1(2) * ArrBytWOWTempArray1(3)
Next
lngNumberResources end up being = 16696
basically it reads a certain value and put it into a array of doubles to be read from later.
it overflows at lngCounter = 1042 (right after the Get)
any clue as to why?
-
Nov 6th, 2002, 09:31 PM
#2
Which line overflows? Have you put a breakpoint at that line to see what is in the variables?
-
Nov 6th, 2002, 09:36 PM
#3
Thread Starter
New Member
well, the byte0*byte1 overflows.
128*2 respectively.
I replaced it with 256 with F8, and then replace the code back and it overflowed on the next loop
-
Nov 6th, 2002, 09:39 PM
#4
I wonder how many charact
Byte values are only valid from 0-255....
-
Nov 6th, 2002, 09:41 PM
#5
Thread Starter
New Member
so a byte * a byte cannot be greater than 255 even if the value is placed into a double?
-
Nov 6th, 2002, 09:49 PM
#6
I think that is correct, since the math is done, then assigned to the variable, so given the current amount of storage the two Bytes have, it would overflow.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 6th, 2002, 09:51 PM
#7
I wonder how many charact
You'd have to convert them to doubles first, then multiply them...
Last edited by nemaroller; Nov 6th, 2002 at 09:55 PM.
-
Nov 6th, 2002, 10:02 PM
#8
Hyperactive Member
You need to change from byte multiplication to something bigger.
eg
change
Code:
ArrDblResources(lngCounter) = ArrBytWOWTempArray1(0) * ArrBytWOWTempArray1(1)
to
Code:
ArrDblResources(lngCounter) = cLng(ArrBytWOWTempArray1(0)) * ArrBytWOWTempArray1(1)
-
Nov 6th, 2002, 10:02 PM
#9
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|