Package

purescript-decimals

Repository
sharkdp/purescript-decimals
License
MIT
Uploaded by
sharkdp
Published on
2022-07-12T11:56:46Z

A library for calculations with arbitrary precision numbers. This is a simple wrapper around decimal.js.

Module documentation

Example

> let x = fromMaybe zero (fromString "12345.67898765432123456789")
> let y = fromInt 100000
> x + y
(fromString "112345.67898765432123456789")

> toString (x `pow` y)
"3.1479315197661937753e+409151"

> let two = fromNumber 2.0
> sin (pi / two)
(fromString "1")

Installation and usage

You can install this package via Bower. You will also need decimal.js, which can be installed via npm:

bower install purescript-decimals
npm install

For the browser, remember to bundle decimal.js with your code.

Check the package.json file for the supported versions of decimal.json.

Development

bower install
npm install

Then, use pulp to build and run tests.

Modules
Data.Decimal
Dependencies