PDA

View Full Version : Very large number: Mod operator



みどり
06-18-2007, 06:17 AM
Hello everyone, here's a little sub that causes overflow:


Sub zzzzz()
Dim a As Double, b As Double, c As Double
a = 51
b = 19
c = 52
Debug.Print (b ^ c) Mod a
End Sub


By the way, if I do not use Mod operator, it gives the result of b^c as 3.12742749190775E+66. So the problem is with the "Mod" one.

Does anyone know the solution? Thank you!! ^_^

unmarkedhelicopter
06-18-2007, 08:32 AM
This is because beyond a certain value (2^53), double = double + 1
i.e. it loses resolution so your MOD question becomes irrelevant.