deka

Decimal floating point arithmetic https://github.com/massysett/deka

Latest on Hackage:0.6.0.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Omari Norman
Maintained by Omari Norman, omari@smileystation.com

deka

deka provides correctly rounded decimal arithmetic for Haskell.

The core of deka is a binding to the C library mpdecimal. You need to install mpdecimal; otherwise, your executables will not link. mpdecimal is available here:

http://www.bytereef.org/mpdecimal/index.html

mpdecimal has also been packaged for some Linux distributions, such as Debian (libmpdec-dev) and Arch (mpdecimal). deka has been tested with mpdecimal version 2.4.0.

As the author of deka, I have no association with the author of mpdecimal, and any errors in this library are mine and should be reported to omari@smileystation.com or to the Github tracker at

http://www.github.com/massysett/deka

You will want to understand the General Decimal Arithmetic Specification in order to fully understand deka. The specification is at

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

and more about decimal arithmetic generally at

http://speleotrove.com/decimal/

Dependencies

The main deka library depends only on base, bytestring, and parsec, so it shouldn't be difficult to build. The tests use tasty and QuickCheck.

Test status

deka is tested using the tests available on the General Decimal Arithmetic website:

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

Some of these tests currently fail. The failures are in edge cases that should not affect most usage. Diagnosing these failures is on the TODO list.

More documentation

Much more documentation is available in the Haddock comments in the source files. There is also a file of examples to get you started. It has copious comments. It is written in literate Haskell, so the compiler keeps me honest with the example code. Unfortunately Haddock does not play very nice with literate Haskell. However, the file is easy to view on Github:

Examples

License

deka is licensed under the BSD license, see the LICENSE file.

Changes

version 0.6.0.2:

* changed build system to use cartel.

* moved tests to separate package, deka-tests

version 0.6.0.0:

* switch to mpdecimal for the underlying C library. This allows
higher limits on exponents and precision. All arithmetic is now
(practically speaking) arbitrary precision. This also allows more
operations, such as logarithms and all exponents. As a possible
disadvantage, this might be slower than decNumber (but I have not
benchmarked this.)

version 0.4.0.4:

* test with GHC 7.8.2

* bundle in decNumber for easier building.

version 0.4.0.2:

* remove version upper bounds

* lower version lower bounds to allow building with GHC 7.4

* add Sunlight tests

version 0.4.0.0:

* removed bindings-dsl; see comments in git log

* made Quad an instance of Eq and Ord

version 0.2.0.2:

* updated .travis.yml for decnumber dependency

* Removed spurious dependencies from .cabal file
Used by 1 package:
comments powered byDisqus