bignumber.js vs. big.js vs. decimal.js vs native (v4)

Revision 4 of this benchmark created by toxinboy on


Preparation HTML

<script src="https://rawgithub.com/iriscouch/bigdecimal.js/v0.6.1/lib/bigdecimal.js"></script>
<script src="https://rawgithub.com/MikeMcl/bignumber.js/v1.3.0/bignumber.min.js"></script>
<script src="https://rawgithub.com/MikeMcl/big.js/v2.5.0/big.min.js"></script>
<script src="https://rawgithub.com/MikeMcl/decimal.js/v2.0.3/decimal.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
Big relative
var a = new Big("0.1")
var b = new Big("0.2")
a.plus(0.2).times(0.2).toString()
ready
Big
var a = new Big("0.1")
var b = new Big("0.2")
a.plus(b).times(b).toString()
ready
Decimal
var a = new Decimal("0.1")
var b = new Decimal("0.2")
a.plus(b).times(b).toString()
ready
Native
var a = 0.1;
var b = 0.2;
((a + b) * b).toString();
ready

Revisions

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