bignumber.js vs. big.js vs. decimal.js

JavaScript performance comparison

Revision 10 of this test case created by

Preparation code

<script src="http://rawgit.com/dtrebbien/BigDecimal.js/master/build/BigDecimal-all-last.min.js"></script>
<script src="https://rawgithub.com/MikeMcl/bignumber.js/master/bignumber.min.js"></script>
<script src="https://rawgithub.com/MikeMcl/big.js/master/big.min.js"></script>
<script src="https://rawgithub.com/MikeMcl/decimal.js/master/decimal.min.js"></script>
    

Preparation code output

<script src="https://rawgithub.com/MikeMcl/bignumber.js/master/bignumber.min.js"></script> <script src="https://rawgithub.com/MikeMcl/big.js/master/big.min.js"></script> <script src="https://rawgithub.com/MikeMcl/decimal.js/master/decimal.min.js"></script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
BigNumber
var a = new BigNumber("0.1")
var b = new BigNumber("0.2")
a.plus(b).times(b).toString()
pending…
Big
var a = new Big("0.1")
var b = new Big("0.2")
a.plus(b).times(b).toString()
pending…
Decimal
var a = new Decimal("0.1")
var b = new Decimal("0.2")
a.plus(b).times(b).toString()
pending…
BigDecimal
var a = new BigDecimal("0.1")
var b = new BigDecimal("0.2")
a.add(b).multiply(b).toString()
pending…
oridnary
var a = parseFloat("0.1");
var b = parseFloat("0.2");
((a + b) * b).toString();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments