[Haskell-cafe] Confused by ghci output
Ertugrul Söylemez
es at ertes.de
Thu May 31 18:50:22 CEST 2012
Clark Gaebel <cgaebel at uwaterloo.ca> wrote:
> *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.
This has to do with types:
> 3^40 `mod` 3
0
> 3^40 `mod` 3 :: Int
2
When doing number theory always use Integer.
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120531/08536a3e/attachment.pgp>
More information about the Haskell-Cafe
mailing list