From c0b35b452fb9d970e63f3175da7009df7bfafceb Mon Sep 17 00:00:00 2001 From: Oso Oluwafemi Date: Tue, 4 Jul 2017 11:13:18 +0100 Subject: [PATCH] Add files via upload --- documentation/ispositive.md | 18 +++---- documentation/round.md | 1 - documentation/square.md | 51 ++++++++++++++++++ documentation/squareroot.md | 56 +++++++++++++++++++ documentation/subtract.md | 94 ++++++++++++++++++++++++++++++++ documentation/toString.md | 50 +++++++++++++++++ documentation/toWords.md | 57 ++++++++++++++++++++ documentation/tofixed.md | 105 ++++++++++++++++++++++++++++++++++++ documentation/truncate.md | 80 +++++++++++++++++++++++++++ documentation/valueOf.md | 58 ++++++++++++++++++++ 10 files changed, 560 insertions(+), 10 deletions(-) create mode 100644 documentation/square.md create mode 100644 documentation/squareroot.md create mode 100644 documentation/subtract.md create mode 100644 documentation/toString.md create mode 100644 documentation/toWords.md create mode 100644 documentation/tofixed.md create mode 100644 documentation/truncate.md create mode 100644 documentation/valueOf.md diff --git a/documentation/ispositive.md b/documentation/ispositive.md index 72b5f4c..47da10e 100644 --- a/documentation/ispositive.md +++ b/documentation/ispositive.md @@ -29,31 +29,31 @@ If the value of the BigArith object evaluates to "-0", false is returned. ```javascript var ba = new BigArith("-17031986"); -console.log(ba = ba.isPositive()); //logs false to the console +console.log(ba.isPositive()); //logs false to the console ba = new BigArith("+17031986"); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith("999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith("2.4"); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith("0"); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith("-0"); -console.log(ba = ba.isPositive()); //logs false to the console +console.log(ba.isPositive()); //logs false to the console ba = new BigArith(); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith(null); -console.log(ba = ba.isPositive()); //logs true to the console +console.log(ba.isPositive()); //logs true to the console ba = new BigArith(NaN); -console.log(ba = ba.isPositive()); //logs NaN to the console +console.log(ba.isPositive()); //logs NaN to the console ``` More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) diff --git a/documentation/round.md b/documentation/round.md index 61347d8..11132c4 100644 --- a/documentation/round.md +++ b/documentation/round.md @@ -67,7 +67,6 @@ Since the method returns a BigArith object, [method chaining](method_chaining.ht var ba = new BigArith("-17031986"); ba = ba.divide("+17031986").add("24011985").multiply("456785564").subtract("2"); //BigArith object with value "10968327654198974" ``` -``` More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) diff --git a/documentation/square.md b/documentation/square.md new file mode 100644 index 0000000..fa4152f --- /dev/null +++ b/documentation/square.md @@ -0,0 +1,51 @@ +# square() +`square()` returns the square of a number. This has only a method function. + +#### Syntax +##### method function +```javascript +ba.square(); +``` + +### Parameters +#### method function +*none* + +### Return value +#### method function - {BigArith} +A BigArith object with its value equals to the square of the value of the BigArith object it is called on. + +### Description +There is no static method function for `square()` so it should ALWAYS be used as a member function. + + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith("-45.456"); +ba = ba.square(); //BigArith object with value "2066.247936" + +ba = new BigArith("45.5"); +ba = ba.square(); //BigArith object with value "2070.25" + +ba = new BigArith("2"); +ba = ba.square(); //BigArith object with value "4" + +ba = new BigArith("3"); +ba = ba.square(); //BigArith object with value "9" +``` + +#### Method chaining +Since the method returns a BigArith object, [method chaining](method_chaining.html) is possible. +```javascript +var ba = new BigArith("-17031986"); +ba = ba.divide("+17031986").add("24011985").multiply("456785564").subtract("2"); //BigArith object with value "10968327654198974" +``` +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [squareRoot()](https://osofem.github.io/bigarith.js/documentation/squareroot.html) \ No newline at end of file diff --git a/documentation/squareroot.md b/documentation/squareroot.md new file mode 100644 index 0000000..7078b58 --- /dev/null +++ b/documentation/squareroot.md @@ -0,0 +1,56 @@ +# squareRoot() [UNSTABLE] + +> This function is still unstable and in the developmental stage. It takes about `16,309` milliseconds to compute squareroot 2 to two hundred decimal places on a Windows 8 with 2GB RAM, 1.8GHz processor (Google Chrome 58.0.3029.81). Additionally, it does not work with very large numbers _yet!_. + +`squareRoot()` returns the square root of a number. This has only a method function. + +#### Syntax +##### method function +```javascript +ba.squareRoot(); +``` + +### Parameters +#### method function +*none* + +### Return value +#### method function - {BigArith} +A BigArith object with its value equals to the square root of the value of the BigArith object it is called on *to 200 decimal place when necessary*. + +### Description +There is no static method function for `squareRoot()` so it should ALWAYS be used as a member function. + +Negative number returns NaN. + + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith("2"); +ba = ba.squareRoot(); //BigArith object with value "1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147" + +ba = new BigArith("0.5"); +ba = ba.squareRoot(); //BigArith object with value "0.70710678118654752440084436210484903928483593768847403658833986899536623923105351942519376716382078636750692311545614851246241802792536860632206074854996791570661133296375279637789997525057639103028574" + +ba = new BigArith("4"); +ba = ba.squareRoot(); //BigArith object with value "2" + +ba = new BigArith("-3"); +ba = ba.squareRoot(); //NaN +``` + +#### Method chaining +Since the method returns a BigArith object, [method chaining](method_chaining.html) is possible. +```javascript +var ba = new BigArith("-17031986"); +ba = ba.divide("+17031986").add("24011985").multiply("456785564").subtract("2"); //BigArith object with value "10968327654198974" +``` +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [square()](https://osofem.github.io/bigarith.js/documentation/square.html) \ No newline at end of file diff --git a/documentation/subtract.md b/documentation/subtract.md new file mode 100644 index 0000000..a417297 --- /dev/null +++ b/documentation/subtract.md @@ -0,0 +1,94 @@ +# subtract() +subtract() returns the difference of two numbers. There is a method function and a static method function. + +#### Syntax +##### method function +```javascript +ba.subtract(n); +``` + +##### static method function +```javascript +BigArith.subtract(a, b); +``` + +### Parameters +#### method function +##### n - Required - {string|number|BigArith} +A subtrahend with the value of the BigArith object `add()` is called on as the minuend. This could be a string of digits, a number, or a BigArith object. + +#### static method function +##### a - Required - {string|number|BigArith} +The Minuend: this could be a string of digits, a number, or a BigArith object. + +##### b - Required - {string|number|BigArith} +The Subtrahend: this could be a string of digits, a number, or a BigArith object. + +### Return value +#### method function - {BigArith} +A BigArith object with its value equals to the difference between the value of the BigArith object it is called on and n. + +#### static method function - {BigArith} +A BigArith object with its value equals to the difference between a and b. + +### Description +There are two functions which could be used, the *method function*, and the *static method function*. The method function takes one parameter (n) and returns the difference between the value of the BigArith object it is called on and the parameter. + +The static method function takes two parameters (a, b) and is always used as `BigArith.subtract()`. It returns the difference between a and b. + +> Any number parameter (that is not strings of digits or a BigArith) should be between the Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER limits. + + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function + +```javascript +var ba = new BigArith("-17031986"); +ba = ba.subtract("24011985"); //BigArith object with value "-41043971" + +ba = new BigArith("+17031986"); +ba = ba.subtract("24011985"); //BigArith object with value "-6979999" + +ba = new BigArith("3"); +ba = ba.subtract("2"); //BigArith object with value "1" + +ba = new BigArith("-3"); +ba = ba.subtract("2"); //BigArith object with value "-5" + +ba = new BigArith("3"); +ba = ba.subtract("-2"); //BigArith object with value "5" + +ba = new BigArith("8888888888888888888888888888888888888888888888888888888"); +ba = ba.subtract("99999999999999999999999999999999999999999999999999999999999999"); //BigArith object with value "-99999991111111111111111111111111111111111111111111111111111111" + +ba = new BigArith("3"); +ba = ba.subtract(NaN); //NaN +``` + +#### Using the static method function +```javascript +var ba = BigArith.subtract("-17031986", "24011985"); //BigArith object with value "-41043971" +ba = BigArith.subtract("+17031986", "24011985"); //BigArith object with value "-6979999" +ba = BigArith.subtract("3", "2"); //BigArith object with value "1" +ba = BigArith.subtract("-3", "2"); //BigArith object with value "-5" +ba = BigArith.subtract("3", "-2"); //BigArith object with value "5" +ba = BigArith.subtract("8888888888888888888888888888888888888888888888888888888", "99999999999999999999999999999999999999999999999999999999999999"); //BigArith object with value "-99999991111111111111111111111111111111111111111111111111111111" +ba = BigArith.subtract("3", NaN); //NaN +``` + +#### Method chaining +Since the method returns a BigArith object, [method chaining](method_chaining.html) is possible. +```javascript +var ba = new BigArith("-17031986"); +ba = ba.divide("+17031986").add("24011985").multiply("456785564").subtract("2"); //BigArith object with value "10968327654198974" +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [add()](https://osofem.github.io/bigarith.js/documentation/add.html) +* [multiply()](https://osofem.github.io/bigarith.js/documentation/multiply.html) +* [divide()](https://osofem.github.io/bigarith.js/documentation/divide.html) +* [modulus()](https://osofem.github.io/bigarith.js/documentation/modulus.html) \ No newline at end of file diff --git a/documentation/toString.md b/documentation/toString.md new file mode 100644 index 0000000..2adc1d5 --- /dev/null +++ b/documentation/toString.md @@ -0,0 +1,50 @@ +# toString() +`toString()` returns the value of the BigArith object as a strings of digits. + +#### Syntax +##### method function +```javascript +ba.toString(); +``` + +### Parameters +#### method function +*none* + +### Return value +#### method function - {string} +Returns the value of the BigArith object as a strings of digits. + +### Description +If the value of the BigArith object evaluate to NaN, NaN is returned. + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith(1000); +console.log(ba.toString()); //logs "1000" to console + +ba = new BigArith(1e3); +console.log(ba.toString()); //logs "1000" to console + +ba = new BigArith("1000"); +console.log(ba.toString()); //logs "1000" to console + +ba = new BigArith("one thousand"); +console.log(ba.toString()); //logs "1000" to console + +ba = new BigArith(); +console.log(ba.toString()); //logs "0" to console + +ba = new BigArith(NaN); +console.log(ba.toString()); //logs NaN to console +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [toFixed()](https://osofem.github.io/bigarith.js/documentation/tofixed.html) +* [valueOf()](https://osofem.github.io/bigarith.js/documentation/valueof.html) +* [toWords()](https://osofem.github.io/bigarith.js/documentation/towords.html) \ No newline at end of file diff --git a/documentation/toWords.md b/documentation/toWords.md new file mode 100644 index 0000000..db47998 --- /dev/null +++ b/documentation/toWords.md @@ -0,0 +1,57 @@ +# toWords() +`toWords()` 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. + +#### Syntax +##### method function +```javascript +ba.toWords(); +``` + +### Parameters +#### method function +*none* + +### Return value +#### method function - {string} +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. + +### Description +If the value of the BigArith object evaluate to NaN, NaN is returned. + +>This function has a limit of (±1x10^1,005)-0.0000{insert 195 more zeroes}01 (i.e. nine hundred and ninety nine trecentretrigintillion point nine nine nine nine nine {insert 195 more "nine"'s}). + +That is 1,005 length of characteristic (parts before the decimal point) and 200 length of mantissa (parts after the decimal point). If the limit is exceeded, a RangeError is thrown. + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith(1000); +console.log(ba.toWords()); //logs "one thousand" to console + +ba = new BigArith(1e3); +console.log(ba.toWords()); //logs "one thousand" to console + +ba = new BigArith("1000"); +console.log(ba.toWords()); //logs "one thousand" to console + +ba = new BigArith("one thousand"); +console.log(ba.toWords()); //logs "one thousand" to console + +ba = new BigArith("-1002.789"); +console.log(ba.toWords()); //logs "negative one thousand two point seven eight nine" to console + +ba = new BigArith(); +console.log(ba.toWords()); //logs "zero" to console + +ba = new BigArith(NaN); +console.log(ba.toWords()); //logs NaN to console +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [toFixed()](https://osofem.github.io/bigarith.js/documentation/tofixed.html) +* [valueOf()](https://osofem.github.io/bigarith.js/documentation/valueof.html) +* [toString()](https://osofem.github.io/bigarith.js/documentation/tostring.html) \ No newline at end of file diff --git a/documentation/tofixed.md b/documentation/tofixed.md new file mode 100644 index 0000000..4efa26a --- /dev/null +++ b/documentation/tofixed.md @@ -0,0 +1,105 @@ +# toFixed() +`toFixed()` returns a number formatted to a number of decimal places. There is a method function and a static method function. + +#### Syntax +##### method function +```javascript +ba.toFixed([d]); +``` + +##### static method function +```javascript +BigArith.toFixed(n [, d]); +``` + +### Parameters +#### method function +##### d - Optional - {string|number|BigArith} +The number of digits to appear after the decimal point; this may be a value between `0` and `200` (both inclusive). If this is omitted, it is treated as 0. This could be a string of digits, a number, or a BigArith object. + +#### static method function +##### n - Required - {string|number|BigArith} +The number format. This could be a string of digits, a number, or a BigArith object. + +##### d - Optional - {string|number|BigArith} +The number of digits to appear after the decimal point; this may be a value between `0` and `200` (both inclusive). If this is omitted, it is treated as 0. This could be a string of digits, a number, or a BigArith object. + +### Return value +#### method function - {string} +Returns the value of the BigArith object it is called on to parameter `d` decimal places rounded up or down when necessary as string of digits. + +#### static method function - {string} +Returns parameter `n` to parameter `d` decimal places rounded up or down when necessary as string of digits. + +### Description +There are two functions which could be used, the *method function*, and the *static method function*. The method function takes one parameter (d) and returns the value of the BigArith object it is called on to parameter `d` decimal places rounded up or down when necessary as string of digits. If any of the value of the BigArith object or parameter `d` evaluates to NaN, NaN is returned. + +The static method function takes two parameters (n, d) and is always used as `BigArith.toFixed()`. It returns parameter `n` to parameter `d` decimal places rounded up or down when necessary as string of digits. If any of the value of parameters `n` or `d` evaluates to NaN, NaN is returned. + +If parameter `d` is not between 0 and 200 (both inclusive), a RangeError will be thrown. + +> Any number parameter (that is not strings of digits or a BigArith) should be between the Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER limits. + +### Examples + +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith("0.5"); +console.log(ba.toFixed()); //logs "1" to console, notice it was rounded up + +ba = new BigArith("0.45"); +console.log(ba.toFixed()); //logs "0" to console, notice it was rounded down + +ba = new BigArith("0.45"); +console.log(ba.toFixed(9)); //logs "0.450000000" to console, notice padding with zero + +ba = new BigArith("-1.45"); +console.log(ba.toFixed()); //logs "-1" to console + +ba = new BigArith("-1.5"); +console.log(ba.toFixed()); //logs "-2" to console + +ba = new BigArith("1.45"); +console.log(ba.toFixed(1)); //logs "1.5" to console + +ba = new BigArith("-1.45"); +console.log(ba.toFixed(1)); //logs "-1.5" to console + +ba = new BigArith("-1.55"); +console.log(ba.toFixed(0)); //logs "-2" to console + +ba = new BigArith("9"); +console.log(ba.toFixed(new BigArith("5.9"))); //logs "9.00000" to console + +ba = new BigArith("9"); +console.log(ba.toFixed(200)); //logs "9.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" to console + +ba = new BigArith(NaN); +console.log(ba.toFixed(200)); //NaN + +ba = new BigArith(20); +console.log(ba.toFixed(NaN)); //NaN +``` + +#### Using static method function +```javascript +console.log(BigArith.toFixed("0.5")); //logs "1" to console, notice it was rounded up +console.log(BigArith.toFixed("0.45")); //logs "0" to console, notice it was rounded down +console.log(BigArith.toFixed("0.45", 9)); //logs "0.450000000" to console, notice padding with zero +console.log(BigArith.toFixed("-1.45")); //logs "-1" to console +console.log(BigArith.toFixed("-1.5")); //logs "-2" to console +console.log(ba.toFixed("1.45", 1)); //logs "1.5" to console +console.log(BigArith.toFixed("-1.45", 1)); //logs "-1.5" to console +console.log(BigArith.toFixed("-1.55", 0)); //logs "-2" to console +console.log(BigArith.toFixed("9", new BigArith("5.9"))); //logs "9.00000" to console +console.log(BigArith.toFixed("9", 200)); //logs "9.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" to console +console.log(BigArith.toFixed(NaN, 200)); //NaN +console.log(BigArith.toFixed(20, NaN)); //NaN +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [toString()](https://osofem.github.io/bigarith.js/documentation/tostring.html) \ No newline at end of file diff --git a/documentation/truncate.md b/documentation/truncate.md new file mode 100644 index 0000000..f464c19 --- /dev/null +++ b/documentation/truncate.md @@ -0,0 +1,80 @@ +# truncate() +`truncate()` returns the integer part of a number by removing the fractional part. There is a method function and a static method function. + +#### Syntax +##### method function +```javascript +ba.truncate(); +``` + +##### static method function +```javascript +BigArith.truncate(n); +``` + +### Parameters +#### method function +*none* + +#### static method function +##### n - Required - {string|number|BigArith} +The number to truncate. This could be a string of digits, a number, or a BigArith object. + +### Return value +#### method function - {BigArith} +A BigArith object with its value equals to the integer part of the value of the BigArith object it is called on. + +#### static method function - {BigArith} +A BigArith object with its value equals to the integer part of parameter n. + +### Description +There are two functions which could be used, the *method function*, and the *static method function*. The method function takes no parameter and returns a BigArith object with its value equals to the integer part of the value of the BigArith object it is called on. + +The static method function takes one parameter (n) and is always used as `BigArith.truncate()`. It returns a BigArith object with its value equals to the integer part of parameter n. + +Unlike ceil(), floor(), and round(), truncate() does not do any rounding on the number. It just remove the fractional part and return the integer remaining. + +> Any number parameter (that is not strings of digits or a BigArith) should be between the Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER limits. + + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith("-45.456"); +ba = ba.truncate(); //BigArith object with value "-45" + +ba = new BigArith("-45.5"); +ba = ba.truncate(); //BigArith object with value "-45" + +ba = new BigArith("0.4"); +ba = ba.truncate(); //BigArith object with value "0" + +ba = new BigArith("0.5"); +ba = ba.truncate(); //BigArith object with value "0" +``` + +#### Using the static method function +```javascript +var ba = BigArith.truncate("-45.456"); //BigArith object with value "-45" +ba = BigArith.truncate("-45.5"); //BigArith object with value "-45" +ba = BigArith.truncate("0.4"); //BigArith object with value "0" +ba = BigArith.truncate("0.5"); //BigArith object with value "0" +``` + +#### Method chaining +Since the method returns a BigArith object, [method chaining](method_chaining.html) is possible. +```javascript +var ba = new BigArith("-17031986"); +ba = ba.divide("+17031986").add("24011985").multiply("456785564").subtract("2"); //BigArith object with value "10968327654198974" +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [abs()](https://osofem.github.io/bigarith.js/documentation/abs.html) +* [ceil()](https://osofem.github.io/bigarith.js/documentation/ceil.html) +* [floor()](https://osofem.github.io/bigarith.js/documentation/floor.html) +* [negate()](https://osofem.github.io/bigarith.js/documentation/negate.html) +* [round()](https://osofem.github.io/bigarith.js/documentation/round.html) \ No newline at end of file diff --git a/documentation/valueOf.md b/documentation/valueOf.md new file mode 100644 index 0000000..30ade25 --- /dev/null +++ b/documentation/valueOf.md @@ -0,0 +1,58 @@ +# valueOf() +`valueOf()` returns the value of the BigArith object as a number. + +#### Syntax +##### method function +```javascript +ba.valueOf(); +``` + +### Parameters +#### method function +*none* + +### Return value +#### method function - {number} +Returns the value of the BigArith object as a number. + +### Description +If the value of the BigArith object evaluate to NaN, NaN is returned. + +> NOTE: Use this function with caution as JavaScript numbers looses precision once it is greater than Number.MAX_SAFE_INTEGER or lesser than Number.MIN_SAFE_INTEGER and becomes "Infinity" when it is greater than Number.MAX_VALUE and "-Infinity" when it is less than Number.MIN_VALUE. + +### Examples +> In the server-side, always remember to add the line `var BigArith = require('bigarith.js');` however every other thing remains the same in both server-side and client-side code. + +#### Using method function +```javascript +var ba = new BigArith(1000); +console.log(ba.valueOf()); //logs 1000 to console + +ba = new BigArith(1e3); +console.log(ba.valueOf()); //logs 1000 to console + +ba = new BigArith("1000"); +console.log(ba.valueOf()); //logs 1000 to console + +ba = new BigArith("one thousand"); +console.log(ba.valueOf()); //logs 1000 to console + +ba = new BigArith("-1002.789"); +console.log(ba.valueOf()); //logs -1002.789 to console + +ba = new BigArith(); +console.log(ba.valueOf()); //logs 0 to console + +ba = new BigArith("999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"); +console.log(ba.valueOf()); //logs Infinity to console + +ba = new BigArith(NaN); +console.log(ba.valueOf()); //logs NaN to console +``` + +More examples [here](https://github.com/osofem/bigarith.js/tree/master/examples/). Full documentation [here](https://github.com/osofem/bigarith.js/tree/master/documentation) + +### See also +* [toFixed()](https://osofem.github.io/bigarith.js/documentation/tofixed.html) +* [toWords()](https://osofem.github.io/bigarith.js/documentation/towords.html) +* [toString()](https://osofem.github.io/bigarith.js/documentation/tostring.html) \ No newline at end of file