fast-arithmetic: Fast functions on integers.

[ algorithms, ats, bsd3, combinatorics, ffi, library, math, number-theory, numerics ] [ Propose Tags ]

Fast functions for number theory and combinatorics with a high level of safety guaranteed by ATS. This package also provides a Storable instance for GMP's mpz type.

[Skip to Readme]
Dependencies base (>=4.7 && <5), composition-prelude (<, recursion-schemes [details]
License BSD-3-Clause
Copyright Copyright: (c) 2018 Vanessa McHale
Author Vanessa McHale
Revised Revision 1 made by vmchale at Thu Mar 29 05:29:17 UTC 2018
Category Numerics, Math, Algorithms, Number Theory, Combinatorics
Home page
Source repo head: git clone
Uploaded by vmchale at Mon Jan 8 02:57:39 UTC 2018
Distributions NixOS:
Downloads 3065 total (599 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-01-08 [all 1 reports]
Hackage Matrix CI





Enable -Werror and don't clean ATS libraries between builds.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


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

For package maintainers and hackage trustees

Readme for fast-arithmetic-

[back to package description]


Build Status

This is a library for fast arithmetical functions using ATS, with a Haskell wrapper.

It is intended to supplement (but not replace) arithmoi where speed is important. In particular, this library provides a fast primality check.


| Computation | Version (ATS/Haskell) | Time | | ----------- | --------------------- | ---- | | isPrime 2017 | ATS | 118.9 ns | | isPrime 2017 | Haskell | 497.3 ns | | φ(2016) | ATS | 5.574 μs | | φ(2016) | Haskell | 177.3 μs | | τ(3018) | ATS | 7.962 μs | | τ(3018) | Haskell | 35.87 μs | | ω(91) | ATS | 282.1 ns | | ω(91) | Haskell | 1.194 μs |


The Haskell library comes with the C bundled, however you will likely want to build from source if you are hacking on the library. To that end, you can install stack, patsopt, and pats-filter and build with

 $ ./shake.hs

You will also likely want to install GHC as well as cabal.


You can find documentation for the Haskell library on Hackage. Unfortunately, there is no documentation for the ATS library, however, you may find the bundled source code informative.