Skip to content

Commit 2404033

Browse files
committed
Add example code
1 parent 2b2a5a5 commit 2404033

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ A library for calculations with arbitrary length integers.
44
This is a simple wrapper around [BigInteger.js](https://github.com/peterolson/BigInteger.js)
55
by [Peter Olson](https://github.com/peterolson).
66

7+
## Example
8+
9+
```purescript
10+
x = fromInt 42
11+
y = (fromJust <<< fromBase 16) "fe45aab12"
12+
mersenne10 = (fromInt 2) `pow` (fromInt 89) - one
13+
14+
> x `pow` x
15+
fromString "150130937545296572356771972164254457814047970568738777235893533016064"
16+
17+
> toNumber (y * mersenne10)
18+
4.2248205181941055e+37
19+
20+
> prime mersenne10
21+
true
22+
```
23+
724
## Module documentation
825

926
- [Data.BigInt](docs/Data/BigInt.md)

0 commit comments

Comments
 (0)