Skip to content
No description, website, or topics provided.
Haskell
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.
src/Data
tests
.gitignore Removed unnecessary directory stack. Jan 3, 2018
Decimal.cabal Minor tweaks to get it to upload nicely to Hackage. Jan 3, 2018
LICENSE.txt Removed unnecessary directory stack. Jan 3, 2018
README.md Minor tweaks to get it to upload nicely to Hackage. Jan 3, 2018
Setup.hs Removed unnecessary directory stack. Jan 3, 2018
changelog.md Minor tweaks to get it to upload nicely to Hackage. Jan 3, 2018
stack.yaml Removed unnecessary directory stack. Jan 3, 2018

README.md

Haskell-Decimal

Fixed-precision decimal numbers, where the precision is carried with the numbers at run-time.

The Decimal type is mainly intended for doing financial arithmetic where the number of decimal places may not be known at compile time (e.g. for a program that handles both Yen and Dollars) and the application must not drop pennies on the floor. For instance if you have to divide $10 between three people then one of them has to get $3.34.

The number of decimal places in a value is represented as a Word8, allowing for up to 255 decimal places. Functions preserve precision. Addition and subtraction operators return a result with the precision of the most precise argument, so 2.3 + 5.678 = 7.978. Multiplication and division use whatever precision is necessary up to 255 decimal places.

QuickCheck Specification

Data.Decimal includes a set of QuickCheck properties which act as both tests and a formal specification. To run the tests do:

cabal configure --enable-tests cabal build cabal test

or

stack test

You can’t perform that action at this time.