Skip to content

Commit

Permalink
Version 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardSergeev committed Jun 26, 2024
1 parent ee9bda2 commit 2982a35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## Unreleased
## [0.0.2] - 2024-06-26
### Added
* Basic functionality exposed via `Decimal (m :: Type) (s :: Nat)` type
* Test suite
* Benchmark suite
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@
[![Test Coverage](https://coveralls.io/repos/github/EduardSergeev/fixed-decimal/badge.svg)](https://coveralls.io/github/EduardSergeev/fixed-decimal)
[![Documentation](https://eduardsergeev.github.io/fixed-decimal/haddock.svg)](https://eduardsergeev.github.io/fixed-decimal/haddock/)

[Fixed-precision decimals](https://en.wikipedia.org/wiki/Fixed-point_arithmetic) for Haskell
Fixed-precision decimals for Haskell

# The purpose of this package

To provide simple high-performance [fixed-precision decimals](https://en.wikipedia.org/wiki/Fixed-point_arithmetic) data types for Haskell.

High-performance in this implementation is achieved because:

1. The implementation is fixed-precision on type-level and is never recalculated so internally only fast integral-arithmetic is used;
1. It never checks for arithmetic overflows or precision overflow;
1. It does not do any rounding of any sort.

It is assumed that the user of this package will choose an appropriate (large enough) [Integral](https://hackage.haskell.org/package/base/docs/Prelude.html#t:Integral) type to store mantissa and will specify an appropriate scale (the length of the fractional part) to accommodate any possible values user's code can produce.

As a result the [performance of this implementation](https://eduardsergeev.github.io/fixed-decimal/ubuntu-latest/results.html), especially for smaller `Integral` mantissas is in-par (or faster) than standard `Double` and much faster than arbitrary precision decimal implementations.

# How to use it

Expand Down Expand Up @@ -48,7 +62,7 @@ To use mantissa of arbitrary length use `Integer`:
0.33333333333333333333333333333333333333333333333333
```

# Why
# Fixed-precision vs floating point numeric types

In comparison to floating-point numeric data types like `Float` or `Double` fixed-precision decimals can store decimal numbers with exact precision.

Expand Down

0 comments on commit 2982a35

Please sign in to comment.