Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixed Precision Arithmetic

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 Numeric
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 fixed-precision.cabal


Provides a light-weight interface to Ales Bisjak's hmpfr bindings to MPFR for Haskell.

Phantom types carry the information about the precision and rounding mode.


Use a 53 bit mantissa (the same size as used by a Double), and round down intermediate results:

sin pi :: Fixed Down Double

Use a 256 bit mantissa, and round intermediate results to the nearest value:

pi :: Fixed Near $(bits 256)

Specify a mantissa size at runtime:

reifyPrecision 512 (\(p::p) -> show (logBase 10 2 :: Fixed Near p)) 

Contact Information

Please, feel free to contact me with questions, concerns, or bug fixes.

I can be reached as ekmett via github or as edwardk on the #haskell IRC channel on

-Edward Kmett

Something went wrong with that request. Please try again.