It's half the size with half the methods and only works with decimal numbers; it also does not allow `NaN` or `Infinity`, or have the configuration options of this library.
## Load
The library is the single Javascript file *bignumber.js*
(or *bignumber.min.js*, which is *bignumber.js* minified using uglify-js).
It can be loaded via a script tag in an HTML document for the browser
Like Javascript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods
x = new BigNumber(255.5)
x.toExponential(5) // "2.55500e+2"
x.toFixed(5) // "255.50000"
x.toPrecision(5) // "255.50"
and a base can be specified for `toString`.
x.toString(16) // "ff.8"
The maximum number of decimal places and the rounding mode for division, square root, base conversion, and negative power operations is set by a configuration object passed to the `config` method of the `BigNumber` constructor.
The other arithmetic operations always give the exact result.
For futher information see the API reference in the *doc* folder.
## Test
The *test* directory contains the test scripts for each method.
The tests can be run with Node or a browser.
For a quick test of all the methods, from a command-line shell at the *test/* directory
$ node quick-test
To test a single method in more depth, e.g.
$ node toFraction
To test all the methods in more depth
$ node every-test
For the browser, see *quick-test.html*, *single-test.html* and *every-test.html* in the *test/browser* directory.
*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of Javascript's Number type.
## Performance
The *perf* directory contains two applications and a *lib* directory containing the BigDecimal libraries used by both.
*bignumber-vs-bigdecimal.html* tests the performance of bignumber.js against the Javascript translations of two versions of BigDecimal, its use should be more or less self-explanatory.
The BigDecimal in Node's npm registry is the GWT version. Despite its seeming popularity I have found it to have some serious bugs, see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods.
*bigtime.js* is a Node command-line application which tests the performance of bignumber.js against the GWT version of BigDecimal from the npm registry.
For example, to compare the time taken by the bignumber.js `plus` method and the BigDecimal `add` method:
$ node bigtime plus 10000 40
This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.
For help:
$ node bigtime -h
See the README in the directory for more information.
## Build
I.e. minify.
For Node, if uglify-js is installed globally ( `npm install uglify-js -g` ) then