|
-
May 27th, 2001, 06:58 PM
#1
Thread Starter
New Member
Mod Overflow?
Why do I get an overflow error while doing 055755241763 Mod 94?
It is being output to a variable that is of type double...
-
May 27th, 2001, 07:02 PM
#2
PowerPoster
Probably because 055755241763 is simply too big for the Mod.
-
May 27th, 2001, 07:03 PM
#3
Thread Starter
New Member
Then whats the max number for mod? Is there any war around this?
-
May 27th, 2001, 07:08 PM
#4
PowerPoster
After a bit of experimenting, the max number is 999999999 (9 chars long). Anything above that causes the overflow. I can't think of anyway way round it. Even if you took only a quarter of that number it would still be 11 chars long.
-
May 27th, 2001, 07:12 PM
#5
Registered User
Create your own mod operator by seeing if:
number/interval = int(number/interval) then 0 else get remainder
-
May 27th, 2001, 07:13 PM
#6
Thread Starter
New Member
Function Modular(Num1, Num2)
Divided = Num1 / Num2
If Divided = Int(Divided) Then
Modular = 0
Else
FractionPart = Divided - Int(Divided)
Modular = FractionPart * Num2
End If
End Function
Last edited by StuMan1337; May 27th, 2001 at 07:16 PM.
-
May 27th, 2001, 07:27 PM
#7
Registered User
Code:
Function NuMod(ByVal x As Double, y As Double) As Double
'Nucleus
x = CInt(x): y = CInt(y) 'round floating point numbers To integers
If x / y = CInt(x / y) Then NuMod = 0 Else NuMod = x - Int(x / y) * y
End Function
Last edited by Nucleus; May 27th, 2001 at 07:49 PM.
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
|