sharkdp / purescript-decimals

Arbitrary precision numbers for PureScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

purescript-decimals

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.

About

Arbitrary precision numbers for PureScript

License:MIT License


Languages

Language:PureScript 76.7%Language:JavaScript 20.9%Language:Dhall 2.5%