Skip to content

A useful type for working with integers modulo some constant.

License

Notifications You must be signed in to change notification settings

TripShot/modular-arithmetic

 
 

Repository files navigation

Modular Arithmetic

Hackage package

This package provides a type for integers modulo some constant, usually written as ℤ/n.

Here is a quick example:

>>> 10 * 11 :: ℤ/7
5

It also works correctly with negative numeric literals:

>>> (-10) * 11 :: ℤ/7
2

Modular division is an inverse of modular multiplication. It is defined when divisor is coprime to modulus:

>>> 7 `div` 3 :: ℤ/16
13
>>> 3 * 13 :: ℤ/16
7

About

A useful type for working with integers modulo some constant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 64.7%
  • Nix 35.3%