arithmoi-0.5.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2011 Daniel Fischer
LicenseMIT
MaintainerDaniel Fischer <daniel.is.fischer@googlemail.com>
StabilityProvisional
PortabilityNon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.GCD.LowLevel

Contents

Description

Low level gcd and coprimality functions using the binary gcd algorithm. Normally, accessing these via the higher level interface of Math.NumberTheory.GCD should be sufficient.

Synopsis

Specialised GCDs

gcdInt :: Int -> Int -> Int #

Greatest common divisor of two Ints, calculated with the binary gcd algorithm.

gcdWord :: Word -> Word -> Word #

Greatest common divisor of two Words, calculated with the binary gcd algorithm.

GCDs for unboxed types

gcdInt# :: Int# -> Int# -> Int# #

Greatest common divisor of two Int#s, calculated with the binary gcd algorithm.

gcdWord# :: Word# -> Word# -> Word# #

Greatest common divisor of two Word#s, calculated with the binary gcd algorithm.

Specialised tests for coprimality

coprimeInt :: Int -> Int -> Bool #

Test whether two Ints are coprime, using an abbreviated binary gcd algorithm.

coprimeWord :: Word -> Word -> Bool #

Test whether two Words are coprime, using an abbreviated binary gcd algorithm.

Coprimality tests for unboxed types

coprimeInt# :: Int# -> Int# -> Bool #

Test whether two Int#s are coprime.

coprimeWord# :: Word# -> Word# -> Bool #

Test whether two Word#s are coprime.