[Haskell-cafe] [ANN] deka - decimal arithmetic

Omari Norman omari at smileystation.com
Sat Feb 8 20:06:18 UTC 2014


Announcing deka, a library for decimal arithmetic.

Why decimal arithmetic is important is discussed at length at

http://speleotrove.com/decimal/

but for a short explanation, go into ghci and type:

print $ 0.1 + 0.1 + 0.1

This is 0.3, right? But on my machine I get 0.3 plus a small fraction,
which is simply not acceptable for applications where it is essential to
get exact results, such as financial applications.

deka is a binding to the decNumber C library, a thoroughly tested and fast
implementation of decimal arithmetic.  deka is fully tested and I encourage
you to run the tests using the usual "cabal test" method.

deka is available at

http://hackage.haskell.org/package/deka

and is on Github at

https://github.com/massysett/deka

Because deka is a binding to the decNumber C library, first you will need
to install decNumber.  An easy to install version with the GNU autotools is
at:

https://github.com/massysett/decnumber/releases

decNumber's website is at

http://speleotrove.com/decimal/decnumber.html

A literate Haskell file illustrating the use of deka is available at

https://github.com/massysett/deka/blob/master/lib/Data/Deka/Docs/Examples.lhs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140208/ae455056/attachment.html>


More information about the Haskell-Cafe mailing list