<font face="verdana,sans-serif">Wow, thanks! That was subtle.<br><br>  - Clark<br></font><br><div class="gmail_quote">On Thu, May 31, 2012 at 12:49 PM, Claude Heiland-Allen <span dir="ltr">&lt;<a href="mailto:claude@goto10.org" target="_blank">claude@goto10.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Clark,<br>
<br>
ghci is defaulting to Integer<br>
modexp2 forces Int<br>
Int overflows with 3^40<div class="im"><br>
<br>
On 31/05/12 17:35, Clark Gaebel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*X&gt;  3^40 `mod` 3 == modexp2 3 40 3<br>
False<br>
</blockquote>
<br></div>
*X&gt; fromInteger (3^40 `mod` 3) == modexp2 3 40 3<br>
True<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*X&gt;  modexp2 3 40 3<br>
0<br>
*X&gt;  3^40 `mod` 3<br>
0<br>
</blockquote>
<br></div>
*X&gt; 3^40 `mod` 3 ::Int<div class="im"><br>
2<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m confused. Last I checked, 0 == 0.<br>
</blockquote>
<br></div>
Int overflow is ugly!<br>
<br>
*X&gt; 3^40<br>
12157665459056928801<br>
*X&gt; maxBound :: Int<br>
9223372036854775807<br>
<br>
<br>
Claude<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
Using GHC 7.4.1, and the file x.hs (which has been loaded in ghci) can be<br>
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<br>
<br>
<br>
<br>
<br></div>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
<br>
</blockquote></div><br>