bigarith.js
Version:
Do very large math to precision!
50 lines (37 loc) • 1.6 kB
Markdown
`toString()` returns the value of the BigArith object as a string of digits.
```javascript
ba.toString();
```
*none*
Returns the value of the BigArith object as a string of digits.
If the value of the BigArith object evaluate to NaN, NaN is returned.
> 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.
```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)
* [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)