For some reason, the following statement evaluates to zero. I assume it's due to overflow, but all the interim values seem to be well within the limits of a double.
DiffieHellmanKey = (43 ^ 47) - (53 * Fix((43 ^ 47) / 53))
I think it's overflow because when I execute it with different numbers (below), it results in the correct value of 29.
DiffieHellmanKey = (5 ^ 22) - (53 * Fix((5 ^ 22) / 53))
What gives? Now, back to the original numbers that are giving me overflow. All variables involved are Doubles. It doesn't even work if I calculate it as a Worksheet formula instead of in VBA:
=(43 ^ 47) - (53 * ROUNDDOWN(((43 ^ 47) / 53), 0))
And if I implement the above example in VBA using the equivalent form (below), I get an incorrect result of -1.75357E+62.
DiffieHellmanKey = (43 ^ 47) - (53 * WorksheetFunction.RoundDown(((43 ^ 47) / 53), 0))