|
-
Mar 22nd, 2000, 04:06 PM
#1
Thread Starter
New Member
Hi,
I am looking for some functions to do addition, subtraction, multiplication and division for numbers of any length. Can anybody help?
-
Mar 22nd, 2000, 04:56 PM
#2
Frenzied Member
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."
-
Mar 23rd, 2000, 01:28 PM
#3
Thread Starter
New Member
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
-
Mar 23rd, 2000, 07:21 PM
#4
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.
-
Mar 25th, 2000, 05:52 AM
#5
Thread Starter
New Member
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
-
Mar 25th, 2000, 06:30 AM
#6
transcendental analytic
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|