Results 1 to 6 of 6

Thread: Very large numbers

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    Hi,
    I am looking for some functions to do addition, subtraction, multiplication and division for numbers of any length. Can anybody help?

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I saw something in PlanetSourceCode yesterday:
    http://www.planetsourcecode.com/vb

    Go there and search for "big number"

    this may help.





    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    Thanks for your help, I have downloaded the code and will try to decipher it to see how I can modify it to handle numbers above 32K in length - may be add some speed for addition/subtraction. It is the division part that has me stumped!

    Andreas

  4. #4
    Guest
    T|Is this big enough?

    CURRENCY:
    Currency variables are stored as 64-bit (8-byte) numbers in an integer format, scaled by 10,000 to give a fixed-point number with 15 digits to the left of the decimal point and 4 digits to the right. This representation provides a range of -922,337,203,685,477.5808 to 922,337,203,685,477.5807. Thetype-declaration character for Currency is the at sign (@).

    The Currency data type is useful for calculations involving money and for fixed-point calculations in which accuracy is particularly important.


  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    Hi Vincent,
    Thanx for your reply. This is certainly a big number - and a lot of currency (oh, to win the lotto!).
    However, I was more thinking along the lines of using strings, with the limitation of the the largest number that can be processed being the length of the string to be stored as a Long Integer - 2^31 in length.

    I guess addition could be done in 'chunks', converting parts of the string from right to left into values, doing the addition, checking for a carry, converting to string and taking the next chunk until finished.

    I was just hoping that someone might have already done this so I don't have to reinvent the wheel, plus I don't actually do that much VB and it would save me a considerable amount of time.

    Regards,
    Andreas

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's more money thatn in Currency: The Decimal 14 bytes: +/-79,228,162,514,264,337,593,543,950,335 with no decimal point;
    +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest

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