deka: Decimal floating point arithmetic

[ bsd3, library, math ] [ Propose Tags ]

deka provides decimal floating point arithmetic. It is based on the decNumber C library, which is available at

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

decNumber, in turn, implements the General Decimal Arithmetic Specification, which is available at

http://speleotrove.com/decimal/

To use deka, you will first need to install the decNumber C library. To make this easy for users of UNIX-like operating systems, I have packaged decNumber; the package is at

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

For more on deka, please see the Github home page at

https://github.com/massysett/deka


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.2.0.0, 0.2.0.2, 0.4.0.0, 0.4.0.2, 0.4.0.4, 0.6.0.0, 0.6.0.2
Change log ChangeLog
Dependencies base (>=4.6 && <4.7), bytestring (>=0.10 && <0.11) [details]
License BSD-3-Clause
Author Omari Norman
Maintainer omari@smileystation.com
Category Math
Home page http://www.github.com/massysett/deka
Uploaded by OmariNorman at 2014-02-10T22:41:43Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 5469 total (19 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed [all 1 reports]

Readme for deka-0.4.0.0

[back to package description]

deka provides correctly rounded decimal arithmetic for Haskell.

Currently the library is nearly done, but it needs more tests and documentation, which I'm working on. Use at your own risk.

The core of deka is a binding to the C library decNumber. As the author of deka, I have no association with the author of decNumber, 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

deka uses the decQuad functions in decNumber. This means that deka is limited to 34 digits of precision. Because 1 quadrillion (that is, one thousand trillion) has only 16 digits of precision, I figure that 34 should be sufficient for many uses. Also, you are limited to exponents no smaller than -6176 and no greater than 6111. deka will notify you if you perform calculations that must be rounded in order to fit within the 34 digits of precision or within the size limits for the exponent.

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

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

and decNumber is at

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

and more about decimal arithmetic generally at

http://speleotrove.com/decimal/

You will need to have the decNumber library installed in order to use this library. I have packaged decNumber for easy installation, as the original decNumber files are distributed as plain C files without any provision for installation as a library. This packaging was done without any collaboration with the author of decNumber, so use it at your own risk. The latest version of the package is downloadable by clicking on the big green button here:

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

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

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

Build Status