It looks like you are overflowing `Int` with 3^40.<div>In your QuickCheck test, the function signature uses Int:</div><div><br></div><div>prop_sanemodexp :: Int -&gt; Int -&gt; Int -&gt; Property</div><div><br></div><div>Note:</div>
<div><div>Prelude&gt; 3^40</div><div>12157665459056928801</div><div>Prelude&gt; 3^40 :: Int</div><div>689956897</div><div><br></div><div><div>Prelude&gt; 3^40 `mod` 3</div><div>0</div><div>Prelude&gt; (3^40 `mod` 3) :: Int</div>
<div>1</div></div><div><br></div><div><br></div><div>L.</div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote">On Thu, May 31, 2012 at 5:35 PM, Clark Gaebel <span dir="ltr">&lt;<a href="mailto:cgaebel@uwaterloo.ca" target="_blank">cgaebel@uwaterloo.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font face="verdana,sans-serif">*X&gt; 3^40 `mod` 3 == modexp2 3 40 3<br>False<br>*X&gt; modexp2 3 40 3<br>0<br>*X&gt; 3^40 `mod` 3<br>
0<br><br>I&#39;m confused. Last I checked, 0 == 0.<br><br>Using GHC 7.4.1, and the file x.hs (which has been loaded in ghci) can be found here: <a href="http://hpaste.org/69342" target="_blank">http://hpaste.org/69342</a><br>




<br>I noticed this after prop_sanemodexp was failing.<br><br>Any help would be appreciated,<br>  - Clark</font>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>