Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Multiply using Decimal.js vs Multiply using native numbers with Math.pow to 10 decimals
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0
Browser:
Chrome 130
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Multiply using Decimal.js
1484.1 Ops/sec
Multiply using native numbers with Math.pow
9073.3 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/decimal.js-light@2.5.0/decimal.min.js'></script>
Script Preparation code:
var x = 5.236;
Tests:
Multiply using Decimal.js
for (var i = 0; i < 1000; i++) { Decimal('0.00253452345').times(Decimal('0.042234')) }
Multiply using native numbers with Math.pow
let precision = 10, factor = Math.pow(10, precision), first = 0.00253452345, sec = 0.042234; for (var i = 0; i < 1000; i++) { (Math.round(first * factor) * Math.round(sec * factor)) / (factor * factor) }