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.

[Skip to Readme]
Versions [RSS] [faq],,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Dependencies base (>1 && <1), composition-prelude, gmpint [details]
License BSD-3-Clause
Copyright Copyright: (c) 2018 Vanessa McHale
Author Vanessa McHale
Revised Revision 2 made by vmchale at 2018-09-25T03:00:46Z
Category Numerics, Math, Algorithms, Number Theory, Combinatorics, FFI, ATS
Home page
Source repo head: git clone
Uploaded by vmchale at 2018-03-03T07:51:01Z
Distributions NixOS:
Downloads 28878 total (988 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2018-03-03 [all 3 reports]


  • Numeric
    • Numeric.Combinatorics
    • Numeric.Integer
    • Numeric.NumberTheory
    • Numeric.Pure

Manual Flags


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

Automatic Flags

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 and combinat where speed is important. In particular, this library provides a fast primality check and fast computation of basic combinatorial functions.


Computation Version (ATS/Haskell) Time
isPrime 2017 ATS 118.9 ns
isPrime 2017 Haskell 497.3 ns
φ(2016) ATS 230.1 ns
φ(2016) Haskell 402.8 ns
τ(3018) ATS 438.5 ns
τ(3018) Haskell 726.4 ns
σ(115) ATS 38.37 ns
σ(115) Haskell 310.0 ns
ω(91) ATS 66.59 ns
ω(91) Haskell 338.6 ns
160! ATS 4.081 μs
160! Haskell 6.032 μs
79!! ATS 813.8 ns ns
79!! Haskell 1.395 μs
322 `choose` 16 ATS 629.8 ns
322 `choose` 16 Haskell 1.046 μs

See here for more.


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 atspkg, and build with

 $ atspkg build


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