HTML Preparation code:
x
 
1
<script src="https://cdn.jsdelivr.net/npm/bigdecimal@0.6.1/lib/bigdecimal.min.js"></script>
2
<script src="https://cdn.jsdelivr.net/npm/bignumber.js@9.0.1/bignumber.min.js"></script>
3
<script src="https://cdn.jsdelivr.net/npm/big.js@6.0.3/big.min.js"></script>
4
<script src="https://cdn.jsdelivr.net/npm/decimal.js@10.2.1/decimal.min.js"></script>
5
<script src="https://cdn.jsdelivr.net/npm/fraction.js@4.0.13/fraction.min.js"></script>
6
Tests:
  • decimal.js

     
    var a = new Decimal("0.1");
    var b = new Decimal("0.2");
    a.plus(b).times(b).toString();
  • big.js

     
    var a = new Big("0.1");
    var b = new Big("0.2");
    a.plus(b).mul(b).toString();
  • bignumber.js

     
    var a = new BigNumber("0.1");
    var b = new BigNumber("0.2");
    a.plus(b).multipliedBy(b).toString();
  • bigdecimal.js

     
    var a = new BigDecimal("0.1");
    var b = new BigDecimal("0.2");
    a.add(b).multiply(b).toString();
  • Fraction.js

     
    var a = new Fraction("0.1");
    var b = new Fraction("0.2");
    a.add(b).mul(b).toString();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    decimal.js
    big.js
    bignumber.js
    bigdecimal.js
    Fraction.js

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Chrome 107 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
decimal.js 604702.9 Ops/sec
big.js 1043072.2 Ops/sec
bignumber.js 633461.9 Ops/sec
bigdecimal.js 133575.4 Ops/sec
Fraction.js 1197981.4 Ops/sec