https://github.com/purescript-contrib/purescript-bigints
Arbitrary length integers for PureScript
https://github.com/purescript-contrib/purescript-bigints
Last synced: 7 days ago
JSON representation
Arbitrary length integers for PureScript
- Host: GitHub
- URL: https://github.com/purescript-contrib/purescript-bigints
- Owner: purescript-contrib
- License: mit
- Created: 2015-07-30T20:56:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-22T14:26:13.000Z (about 3 years ago)
- Last Synced: 2025-02-11T23:27:12.664Z (about 1 year ago)
- Language: PureScript
- Homepage:
- Size: 148 KB
- Stars: 26
- Watchers: 4
- Forks: 22
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-bigints
[](https://github.com/sharkdp/purescript-bigints/releases)
[](https://github.com/sharkdp/purescript-bigints/actions?query=workflow%3ACI+branch%3Amaster)
[](https://github.com/gbagan)
**Note**: This package is deprecated. You probably want to use [`purescript-js-bigints`](https://github.com/purescript-contrib/purescript-js-bigints) instead.
A library for calculations with arbitrary length integers.
This is a simple wrapper around [BigInteger.js](https://github.com/peterolson/BigInteger.js)
by [Peter Olson](https://github.com/peterolson).
## Module documentation
- [Published on Pursuit](http://pursuit.purescript.org/packages/purescript-bigints/)
## Example
```purescript
x = fromInt 42
y = (fromJust <<< fromBase 16) "fe45aab12"
mersenne10 = (fromInt 2) `pow` (fromInt 89) - one
> x `pow` x
fromString "150130937545296572356771972164254457814047970568738777235893533016064"
> toNumber (y * mersenne10)
4.2248205181941055e+37
> prime mersenne10
true
```
## Installation and usage
You can install this package via Bower. You will also need [BigInteger.js](https://github.com/peterolson/BigInteger.js), which can be installed via `npm`:
```
bower install purescript-bigints
npm install big-integer
```
For the browser, remember to bundle `BigInteger.min.js` with your code.
## Development
```
bower install
npm install
```
Then, use `pulp` to build, run tests and generate the documentation.