
31 May
2012
31 May
'12
12:52 p.m.
Hi Clark,
On Thu, May 31, 2012 at 10:35 AM, Clark Gaebel
*X> 3^40 `mod` 3 == modexp2 3 40 3 False *X> modexp2 3 40 3 0 *X> 3^40 `mod` 3 0
I'm confused. Last I checked, 0 == 0.
Your HPaste shows the type of modexp2 is Int -> Int -> Int -> Int, so ghci will infer that (3^40) is an Int. But an Int isn't big enough to hold 3^40. Prelude> 3^40 :: Int -6289078614652622815 Prelude> (3^40 :: Int) `mod` 3 2 Kevin -- Kevin Charter kevin.charter@acm.org