Skip to content
Fixed Precision Arithmetic
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Numeric
LICENSE
README.markdown
fixed-precision.cabal

README.markdown

fixed-precision

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.

Usage

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 irc.freenode.net.

-Edward Kmett

You can’t perform that action at this time.