On Thu, May 31, 2012 at 6:35 PM, Clark Gaebel wrote:
*X> 3^40 `mod` 3 == modexp2 3 40 3
False
*X> modexp2 3 40 3
0
*X> 3^40 `mod` 3
0
*X> 3^40 `mod` 3 :: Int
1
*X> 3^40 `mod` 3 :: Integer
0
I'm confused. Last I checked, 0 == 0.
Yes, but 3^40 /= 3^40 when you have arithmetic overflow:
*X> 3^40 :: Int
689956897
*X> 3^40 :: Integer
12157665459056928801
Regards,
Sean