-
Oct 23rd, 2021, 04:04 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] MsgBox 256 * 256
Would someone please explain why
MsgBox 256 * 256
would result in an overflow?
-
Oct 23rd, 2021, 04:34 PM
#2
Re: MsgBox 256 * 256
Because the numbers are seen as integers and the product doesn’t fit in an integer
-
Oct 23rd, 2021, 04:38 PM
#3
Re: MsgBox 256 * 256
numbers are integer, u need to specify that they are something else.
this will work:
MsgBox 256& * 256
has nothing to do with MsgBox.
you could do:
Dim a as long
a = 10000 * 4
and it will give error as well.
-
Oct 23rd, 2021, 05:02 PM
#4
Thread Starter
Hyperactive Member
Re: MsgBox 256 * 256
Thanks a lot.
MsgBox (2 ^ 8) * (2 ^ 8) would also be okay.
-
Oct 23rd, 2021, 05:31 PM
#5
Re: [RESOLVED] MsgBox 256 * 256
yeah, using ^ will change the vartype to double
VarType(2 ^ 8) shows 5, that is Double.
Last edited by baka; Oct 24th, 2021 at 03:56 AM.
-
Oct 24th, 2021, 09:06 PM
#6
Re: MsgBox 256 * 256
Originally Posted by Brenker
Thanks a lot.
MsgBox (2 ^ 8) * (2 ^ 8) would also be okay.
Yes, that is essentially equivalent to
MsgBox (256.0 * 256.0)
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
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
|