Clark Gaebel <cgae...@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/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to