Skip to content

Precise #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.*
!/.gitignore
!/.travis.yml
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/.psci*
/src/.webpack.js
tmp/
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
language: node_js
dist: trusty
sudo: required
node_js:
- stable
node_js: stable
install:
- npm install purescript pulp bower -g
- bower install
- npm install -g bower
- npm install
script:
- pulp build && pulp test
- bower install --production
- npm run -s build
- bower install
- npm -s test
after_success:
- >-
test $TRAVIS_TAG &&
echo $GITHUB_TOKEN | pulp login &&
echo y | pulp publish --no-push
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# purescript-hugenums [![Build Status](https://travis-ci.org/Thimoteus/purescript-hugenums.svg?branch=master)](https://travis-ci.org/Thimoteus/purescript-hugenums)
# purescript-precise

[![Latest release](http://img.shields.io/github/release/purescript-contrib/purescript-precise.svg)](https://github.com/purescript-contrib/purescript-precise/releases)
[![Build status](https://travis-ci.org/purescript-contrib/purescript-precise.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-precise)

This is a library for working with numbers of arbitrarily finite size.

Javascript (and to some extension Purescript) has quite a few drawbacks when it comes to large numbers. For example, Purescript's `Int` primitive [is a member](https://github.com/purescript/purescript-prelude/blob/v0.1.3/src/Prelude.js#L177-L178) of the `Bounded` typeclass, with `top == 2 ^ 31 - 1` and `bottom == - (2 ^ 32)`.
JavaScript (and to some extension PureScript) has quite a few drawbacks when it comes to large numbers. For example, PureScript's `Int` primitive [is a member](https://github.com/purescript/purescript-prelude/blob/v0.1.3/src/Prelude.js#L177-L178) of the `Bounded` typeclass, with `top == 2 ^ 31 - 1` and `bottom == - (2 ^ 32)`.

The Purescript `Number` primitive is not `Bounded` in the same way; however, there are problems with manipulating large-enough `Number`s:
The PureScript `Number` primitive is not `Bounded` in the same way; however, there are problems with manipulating large-enough `Number`s:

```
> import Prelude
Expand Down Expand Up @@ -33,14 +36,12 @@ HugeNum 900000000000000001.0

Addition is implemented using an elementary-school method. Multiplication follows [Karatsuba](https://en.wikipedia.org/wiki/Karatsuba_algorithm).

## documentation

Available on [pursuit](https://pursuit.purescript.org/packages/purescript-hugenums/).

## integers
## Installation

There is also a newtype for integral values in `Data.HugeInt`.
```
bower install purescript-precise
```

## installation
## Documentation

`bower install purescript-hugenums`
Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-precise/).
23 changes: 8 additions & 15 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"name": "purescript-hugenums",
"version": "2.0.1",
"moduleType": [
"node"
],
"name": "purescript-precise",
"license": "MIT",
"ignore": [
"**/.*",
Expand All @@ -13,19 +9,16 @@
],
"repository": {
"type": "git",
"url": "git://github.com/Thimoteus/purescript-hugenums.git"
"url": "git://github.com/purescript-contrib/purescript-hugenums.git"
},
"dependencies": {
"purescript-arrays": "^1.0.0",
"purescript-strings": "^1.0.0",
"purescript-globals": "^1.0.0",
"purescript-integers": "^1.0.0",
"purescript-quickcheck": "~1.0.0"
"purescript-arrays": "^3.0.0",
"purescript-globals": "^2.0.0",
"purescript-integers": "^2.0.0",
"purescript-quickcheck": "^3.0.0",
"purescript-strings": "^2.0.2"
},
"devDependencies": {
"purescript-debugger": "~1.0.0",
"purescript-test-unit": "~7.0.0",
"purescript-quickcheck-laws": "~1.0.0",
"purescript-benchotron": "~4.0.0"
"purescript-quickcheck-laws": "^2.0.0"
}
}
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build --censor-lib --strict",
"test": "pulp test"
},
"devDependencies": {
"pulp": "^9.0.1",
"purescript-psa": "^0.3.9",
"purescript": "^0.10.1",
"rimraf": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion src/Data/Digit.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Data.Digit
, _zero, _one, _two, _three, _four, _five, _six, _seven, _eight, _nine
) where

import Prelude (class Ord, class Eq, class Show, (+), (-), ($), (<=), (&&), (>=), otherwise, compare, (==), show, (<>))
import Prelude
import Data.Maybe (Maybe(..))
import Data.Char (toCharCode, fromCharCode)

Expand Down
2 changes: 1 addition & 1 deletion src/Data/HugeInt.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Data.String (length, drop, takeWhile)
import Data.Int (toNumber)
import Data.Int (round) as Int
import Data.Maybe (Maybe(..))
import Data.HugeNum (HugeNum())
import Data.HugeNum (HugeNum)
import Data.HugeNum as HN

newtype HugeInt = HugeInt HugeNum
Expand Down
Loading