package decimal

  1. Overview
  2. Docs
Arbitrary-precision floating-point decimal library

Install

Dune Dependency

Authors

Maintainers

Sources

decimal-v0.0.3.tbz
sha256=d89ac869107d54b33ca338f0439cd0611b68623a1ee4451fa62043d7a06e1e80
sha512=4c9af25b7b40f49f87673d541e1ad3e592375bb71d79355768572a5cfe911c7b8957164fac170b326626b2b466f8ef7c78bc679d2a005f3f7f168cbc97654fae

Description

Arbitrary-precision floating-point decimal library ported from the Python decimal module.

Published: 15 Nov 2020

README

decimal

Arbitrary-precision floating-point decimal type implemented in OCaml. Ported from Python decimal module. It uses Zarith to do biginteger arithmetic.

License

This package is licensed under the Python Software Foundation License v2, for the sake of simplicity, as it is a derived work of the Python decimal module.

Examples

# (* for convenience *)
  module D = Decimal
  let i = D.of_int
  let s = D.of_string;;
# (* tell the REPL how to display decimals *)
  #install_printer D.pp;;
#
  D.(s "0.1" + s "0.2");;
- : D.t = 0.3
# (* default precision is 32 *)
  D.(i 1 / i 3);;
- : D.t = 0.33333333333333333333333333333333

Dependencies (3)

  1. zarith >= "1.10" & < "2.0.0"
  2. ocaml >= "4.06.0"
  3. dune >= "2.7"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None