Results 1 to 9 of 9

Thread: Data Types And Long Numbers

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Data Types And Long Numbers

    I have the following calculation

    VB Code:
    1. BigNumber = 10000000000000
    2. SmallNumber = 943
    3.  
    4. MsgBox BigNumber \ SmallNumber

    When using any of the Data Types I always get Error 6 "Overflow" returned, is there any way around this?


    Thanks in Advance,


    Matt

  2. #2
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Long should work

  3. #3
    joan_fl
    Guest
    Actually a long wouldnt work... You'll need to use a Single or Double (Single should be fine).

    From Online Help...

    A long integer between – 2,147,483,648 and 2,147,483,647.


    A single-precision floating-point value with a range of – 3.402823E38 to – 1.401298E-45 for negative values, 1.401298E-45 to 3.402823E38 for positive values, and 0.

    A double-precision floating-point value with a range of – 1.79769313486232E308 to – 4.94065645841247E-324 for negative values, 4.94065645841247E-324 to 1.79769313486232E308 for positive values, and 0

  4. #4
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    well, I was wrong

    Im stumped ... Decimal doesnt even work

  5. #5
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    doh! I missed somehting ... use /

    \ is int division

  6. #6
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    VB Code:
    1. Dim bignumber
    2. Dim smallnumber
    3. bignumber = CDec(10000000000000#)
    4. smallnumber = CDec(943)
    5. bignumber = CDec(bignumber)
    6. smallnumber = CDec(smallnumber)
    7. MsgBox bignumber / smallnumber

    that works for sure!

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Well

    I really need to do this :

    VB Code:
    1. bignumber = CDec(10000000000000#)
    2. smallnumber = CDec(943)
    3.  
    4. bignumber mod smallnumber

    It is part of an algorithm and as I said all I get is Error 6 Overflow

    Cheers

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Well

    Using the "Mod" Function and this number "1000000000#" works but when I use the slightly longer number of "100000000000000" it doesn't and that is when I get returned that nasty Overflow Message.

    Cheers

  9. #9
    Addicted Member
    Join Date
    Feb 2002
    Location
    Belgium
    Posts
    190
    remember this
    the number can not by endless

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