Results 1 to 6 of 6

Thread: [RESOLVED] MsgBox 256 * 256

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2014
    Posts
    373

    Resolved [RESOLVED] MsgBox 256 * 256

    Would someone please explain why

    MsgBox 256 * 256

    would result in an overflow?

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: MsgBox 256 * 256

    Because the numbers are seen as integers and the product doesn’t fit in an integer

  3. #3
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    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.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2014
    Posts
    373

    Re: MsgBox 256 * 256

    Thanks a lot.

    MsgBox (2 ^ 8) * (2 ^ 8) would also be okay.

  5. #5
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    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.

  6. #6
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: MsgBox 256 * 256

    Quote Originally Posted by Brenker View Post
    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
  •  



Click Here to Expand Forum to Full Width