Juggler_IN
Active Member
- Joined
- Nov 19, 2014
- Messages
- 349
- Office Version
- 2003 or older
- Platform
- Windows
While working on Big Integer arithmetic I cam across a post at StackExchange. Is there a way to accept integers of length greater than 15?
This version allows for:
SuperMod2("654654321902010548705495321500805040401121210900506078798456849816241968462130000051204789540453745898347543753489751261610093245892737467263468234623689898054456361110010151021101827", 999999999999999)
... to correctly display: 194745570864677.
VBA Code:
Function SuperMod2(ByVal a$, b$)
Do While Len(a) > 15
a = Mid$(a, 1, 15) - Int(Mid$(a, 1, 15) / b) * b & Mid$(a, 16)
Loop
SuperMod2 = a - Int(a / b) * b
End Function
This version allows for:
SuperMod2("654654321902010548705495321500805040401121210900506078798456849816241968462130000051204789540453745898347543753489751261610093245892737467263468234623689898054456361110010151021101827", 999999999999999)
... to correctly display: 194745570864677.