|
-
Apr 12th, 2000, 04:59 PM
#1
Thread Starter
New Member
I'm writing a routine which requires the handling of large numbers.
I've declared all my variables as Variant and I use CDec where required.
However, I get an Overflow Error (6) when I use the MOD operator.It seems to be restricted to Long data-types.
Is there an equivalent I can use, or am i using it incorrectly?
Thanks,
Jim
-
Apr 12th, 2000, 05:24 PM
#2
Frenzied Member
What size numbers are you using?
Using Variants is usually a bad idea
-
Apr 12th, 2000, 06:26 PM
#3
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 12th, 2000, 08:07 PM
#4
Thread Starter
New Member
VERY large numbers!
I've had to use variants in order to use the Decimal sub-type - that's how big they are.
In the order of 1,000,000,000,000,000,000,000
The help file doesn't indicate that MOD is restricted to the LONG range, but that would appear to be the case.
Any APIs?....
-
Apr 12th, 2000, 08:16 PM
#5
-
Apr 12th, 2000, 11:01 PM
#6
Thread Starter
New Member
Sorted it!
Looks like the MOD calculator is limited to the LONG range, but the INT operator is not.
Changed logic to use
Dim Whole as Variant
Whole = CDec(Int(Long_Number / Divisor))
Remainder = Long_number - (Whole * Divisor)
Seems to work fine now - handles the full range of DECIMAL numbers.
(For reference, I'm writing a base-conversion utility and need to be able to handle extremely long hex numbers. My numbers ar enot restricted to just Hex, therefore I can;t use any of the built-in functions.)
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
|