modular-arithmetic: A type for integers modulo some constant.

[ bsd3, library, math ] [ Propose Tags ]

A convenient type for working with integers modulo some constant. It saves you from manually wrapping numeric operations all over the place and prevents a range of simple mistakes. Integer Mod 7 is the type of integers (mod 7) backed by Integer. We also have some cute syntax for these types like ℤ/7 for integers modulo 7.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 1.0.0.0, 1.0.0.1, 1.0.1.0, 1.0.1.1, 1.1.0.0, 1.2.0.0, 1.2.1.0, 1.2.1.1, 1.2.1.2, 1.2.1.3, 1.2.1.4, 1.2.1.5, 2.0.0.0, 2.0.0.1, 2.0.0.2, 2.0.0.3 (info)
Change log CHANGELOG.md
Dependencies base (>4.9 && <4.17), typelits-witnesses (<0.5) [details]
License BSD-3-Clause
Author Tikhon Jelvis <tikhon@jelv.is>
Maintainer Tikhon Jelvis <tikhon@jelv.is>
Revised Revision 1 made by Bodigrim at 2023-02-06T20:05:51Z
Category Math
Home page https://github.com/TikhonJelvis/modular-arithmetic
Bug tracker https://github.com/TikhonJelvis/modular-arithmetic/issues
Source repo head: git clone git://github.com/TikhonJelvis/modular-arithmetic.git
Uploaded by TikhonJelvis at 2022-11-11T02:23:39Z
Distributions NixOS:2.0.0.3
Reverse Dependencies 5 direct, 14 indirect [details]
Downloads 9761 total (50 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for modular-arithmetic-2.0.0.2

[back to package description]

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