|
-
Apr 16th, 2002, 01:09 PM
#1
Thread Starter
Hyperactive Member
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
-
Apr 16th, 2002, 01:32 PM
#2
#1 The number is being implicitly cast into a Long, which can hold a max of about 2 billion. That is causing the overflow.
#2 Why would you need to use a number that big?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 16th, 2002, 01:44 PM
#3
PowerPoster
gonna have to write your own sub, something like:
VB Code:
Private Sub Form_Load()
answer = CDec(answer)
Call LongMod(10000000000000#, 943, answer)
MsgBox (answer)
End Sub
Sub LongMod(a, b, answer)
a = CDec(a)
b = CDec(b)
c = CDec(a / b)
d = Left(CStr(c), InStr(CStr(c), ".") - 1)
answer = CDec(answer)
answer = CDec(a) - CDec(d) * CDec(b)
End Sub
-
Apr 17th, 2002, 05:05 AM
#4
Thread Starter
Hyperactive Member
Well
I need a number that large for use in an algorithm.
I have used this function instead which works with numbers upto 19 digits long
VB Code:
Public Function funcMod(Number As Double, Divisor As Double)
funcMod = Number - (Divisor * Int(Number / Divisor))
End Function
Cheers for your help
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
|