diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d7ea53..f685c34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,14 @@ * Added squareRoot() [unstable] ### v0.0.2 +#### Released - 30th June, 2017 +* Fixed some bugs +* change max() to accept any length of arguments +* change min() to accept any length of arguments + +### v0.0.3 +* make max and min accept mixture of numbers and arrays e.g. max(1, 2, 3, [4, 5, 6]) +* Added power * Added sin() * Added cos() * Added tan() \ No newline at end of file diff --git a/README.md b/README.md index 4ba64c3..2138b57 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Welcome to bigarith.js [![Join the chat at https://gitter.im/BigArith-js/Lobby](https://badges.gitter.im/BigArith-js/Lobby.svg)](https://gitter.im/BigArith-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -`bigarith.js` offers a way to handles **very large numbers** (be it integers, fractionals, strings of digits, strings of english words) to precision. bigarith is from the words big arithmetic. +`bigarith.js` offers a way to handles **very large numbers** (be it integers, fractionals, strings of digits, strings of english words) to precision. bigarith is from the words **big arith**metic. ### Install Depending on the environment in which bigarith.js will be used, it can be installed via: @@ -14,7 +14,7 @@ Server-side usage Client-side usage 1. Including the library from the rawgit.com CDN.
- You can do that by adding <script src="https://cdn.rawgit.com/osofem/bigarith.js/<version tag>/bigarith.js"></script> to your code. Replace <version tag> with the version targetted e.g. v1.0. Check [versions](https://github.com/osofem/bigarith.js/tags) for the latest version (the latest version is always recommended). + You can do that by adding <script src="https://cdn.rawgit.com/osofem/bigarith.js/<version tag>/bigarith.js"></script> to your code. Replace <version tag> with the version targetted e.g. v1.0.0. Check [versions](https://github.com/osofem/bigarith.js/tags) for the latest version (the latest version is always recommended). 2. Downloading the source from GitHub.com
You can also download bigarith.js from [releases](https://github.com/osofem/bigarith.js/releases/) on github.com (the latest version is always recommended). Extract the files and include the bigarith.js file in your work. @@ -38,7 +38,7 @@ var ba = new BigArith(null); //initialize ba to a BigArith object of value "0" var ba = new BigArith(); //initialize ba to a BigArith object of value "0" var ba = new BigArith(null); //initialize ba to a BigArith object of value "0" ``` -This simply initialize the variable ba to a BigArith object of value "0". +This simply initialize the variable ba to a `BigArith` object of value "0". ##### 2. Initiating with a number ###### Server-side @@ -51,9 +51,9 @@ var ba = new BigArith(12345); //initialize ba to a BigArith object of value "123 ```javascript var ba = new BigArith(12345); //initialize ba to a BigArith object of value "12345" ``` -The number must be between the Number.MIN_SAFE_INTEGER (-9007199254740991) and Number.MAX_SAFE_INTEGER (9007199254740991) limits else a RangeError will be thrown. Please note that only integers are recommended for this method because of the floating point precision _problem_ in JavaScript (with is one of the problems BigArith.js aim at solving). +The number must be between the Number.MIN_SAFE_INTEGER (-9007199254740991) and Number.MAX_SAFE_INTEGER (9007199254740991) limits else a RangeError will be thrown. Please note that only integers are recommended for this method because of the floating point precision _problem_ in JavaScript (with is one of the problems bigarith.js aim at solving). -Doing var ba = new BigArith(0.45); might still be considered _"safe"_ but some can be tempted to do var ba = new BigArith(0.1 \* 0.2);. As it is known 0.1 \* 0.2 will not give 0.02 in JavaScript but rather 0.020000000000000004. Therefore, it is better to avoid initializing fractional numbers this way all together. +Doing var ba = new BigArith(0.45); might still be considered _"safe"_ but some could be tempted to do var ba = new BigArith(0.1\*0.2);. As it is known 0.1\*0.2 will not give 0.02 in JavaScript but rather 0.020000000000000004. Therefore, it is better to avoid initializing fractional numbers this way all together. > It is recommended fractional numbers are initialized with strings. > See [here](#init_string). @@ -101,7 +101,7 @@ var bd = new BigArith("point two three seven"); //initialize bd to a BigArith ob A negative number should start with the word "negative", a positive number can start with the "postive" word but this can be outrightly omitted. The mantissa part should be spelt out after the word point or else the word will evaluate to NaN. -This is case insensitive and only [Short Scale](short_scales.html) naming system is supported. +This is case insensitive and only [Short Scale](https://osofem.github.io/bigarith.js/documentation/short_scales.html) naming system is supported. ```javascript var ba = new BigArith("three point one two"); // This evaluate to "3.12" @@ -118,7 +118,7 @@ var ba = new BigArith("PI"); // this evaluate to "3.1415926535897932384626433832 ```javascript var ba = new BigArith("PI"); // this evaluate to "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196" ``` -`bigarith.js` has a list of inbuilt constants which can be used for initialization. Check [here](documentation/list_constant.html) for the updated list. +`bigarith.js` has a list of inbuilt constants which can be used for initialization. Check [here](https://osofem.github.io/bigarith.js/documentation/list_constants.html) for the updated list. ##### 6. Initiating with a BigArith object ###### Server-side @@ -155,7 +155,7 @@ console.log(ba.valueOf());//this outputs -5637865.32 to the console #### toWords() method -The toWords method returns the value of the BigArith object in English words using the [Short Scale](https://osofem.github.io/bigarith.js/documentation/short_scales.html) naming system. If the length of the object's characteristic part (part before the decimal point) is greater than 1,005 or the length of the mantissa part (part after the decimal point) is greater than 200, a RangeError is thrown. +The toWords method returns the value of the BigArith object in English words using the [Short Scale](https://osofem.github.io/bigarith.js/documentation/short_scales.html) naming system. If the length of the object's characteristic part (part before the decimal point) is greater than 1,005 or the length of the mantissa part (part after the decimal point) is greater than 200, a `RangeError` is thrown. ```javascript var ba = new BigArith(1e3); console.log(ba.toWords());//this outputs "one thousand" to the console @@ -181,7 +181,7 @@ See also: 17. [randomInt()](https://osofem.github.io/bigarith.js/documentation/randomint.html) 18. [round()](https://osofem.github.io/bigarith.js/documentation/round.html) 19. [square()](https://osofem.github.io/bigarith.js/documentation/square.html) -20. [squareRoot()](https://osofem.github.io/bigarith.js/documentation/squareroot.html) +20. [squareRoot()](https://osofem.github.io/bigarith.js/documentation/squareroot.html) [unstable] 21. [subtract()](https://osofem.github.io/bigarith.js/documentation/subtract.html) 22. [toFixed()](https://osofem.github.io/bigarith.js/documentation/tofixed.html) 23. [toWords()](https://osofem.github.io/bigarith.js/documentation/towords.html) diff --git a/package.json b/package.json index 6e73bdf..ef7f602 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "bigarith.js", - "version": "0.0.1", + "version": "0.0.2", "description": "Do very large math!", - "main": "BigArith.js", + "main": "bigarith.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", - "url": "https://github.com/osofem/BigArith.js/" + "url": "https://github.com/osofem/bigarith.js/" }, "keywords": [ "math", @@ -18,6 +18,6 @@ "bigmath", "arbitrary-precision" ], - "author": "Oso Oluwafemi (https://osofem.github.io/BigArith.js/)", + "author": "Oso Oluwafemi (https://github.com/osofem)", "license": "Apache-2.0" }