safe-decimal

Safe and very efficient arithmetic operations on fixed decimal point numbers

https://github.com/fpco/safe-decimal#readme

Version on this page:0.2.0.0
LTS Haskell 22.40:0.2.1.0
Stackage Nightly 2024-11-05:0.2.1.0
Latest on Hackage:0.2.1.0

See all snapshots safe-decimal appears in

BSD-3-Clause licensed by Alexey Kuleshevich
Maintained by [email protected]
This version can be pinned in stack with:safe-decimal-0.2.0.0@sha256:1b2a6f38abbd2bad4de46afd7ff2d466dfbff609b20c79bf93bf4e3729445ba2,2137

Module documentation for 0.2.0.0

safe-decimal

Language Travis
GitHub top language Travis
Package Hackage Nightly LTS
safe-decimal Hackage Nightly Nightly

An implementation of a decimal point data type, that is backed by any custom integral type. It is safe, because things like integer overflows, underflows, division by zero etc. are checked for during the runtime and are prevented in pure code.

Changes

Changelog for safe-decimal

0.2.0

  • Add Arith monad and corresponding functions.
  • Make rounding dependent on precision type (extra type argument to the Round type class)
  • Rename RoundFloor to RoundDown (with Floor as synonym)
  • Rename Truncate to RoundToZero (with Truncate as synonym)
  • Fix conversion fromRational to throw Underflow instead of rounding. Without this fix there was unexpected behavior on negative numbers.
  • Addition of scaleUp and scaleUpBounded
  • Addition of toFixedDecimal, fromFixedDecimal and fromFixedDecimalBounded
  • Many function renames, just to make sure they all follow the same convention.
  • Fix RoundHalfUp algorithm
  • Addition of RoundHalfDown and RoundHalfEven

0.1.0

Initial release