bignumber.js vs. big.js vs. decimal.js (v17)

Revision 17 of this benchmark created by roviury on


Preparation HTML

<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>

Setup

var integerPart = (+new Date) % 100000000;
  var decmialA = 0.1234562;
  var decmialB = 0.1234564;
  var valA = integerPart + decmialA;
  var valB = Math.log(integerPart) + decmialB;
  window.valA = valA;
  window.valB = valB;

Test runner

Ready to run.

Testing in
TestOps/sec
BigNumber
var a = new BigNumber((window.valA += 1.23).toString())
var b = new BigNumber((window.valB += 3.21).toString())
a.plus(b).div(b).toString()
ready
Big
var a = new Big((window.valA += 1.23).toString())
var b = new Big((window.valB += 3.21).toString())
a.plus(b).div(b).toString()
ready
Decimal
var a = new Decimal((window.valA += 1.23).toString())
var b = new Decimal((window.valB += 3.21).toString())
a.plus(b).div(b).toString()
ready
BigDecimal
var a = new BigDecimal((window.valA += 1.23).toString())
var b = new BigDecimal((window.valB += 3.21).toString())
a.add(b).div(b).toString()
ready

Revisions

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