Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Multiply using Decimal.js vs Multiply using native numbers with Math.pow to 10 decimals
(version: 1)
Comparing performance of:
Multiply using Decimal.js vs Multiply using native numbers with Math.pow
Created:
one year ago
by:
Guest
Jump to the latest result
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) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Multiply using Decimal.js
Multiply using native numbers with Math.pow
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Multiply using Decimal.js
1484.1 Ops/sec
Multiply using native numbers with Math.pow
9073.3 Ops/sec
Related benchmarks:
decimal.js vs. Fraction.js (no native)
Multiply using Decimal.js vs Multiply using native numbers
Add using Decimal.js vs Add using native numbers
Add using Decimal.js vs native vs Number() vs parseFloat()
Add using Decimal.js vs native JS vs Number() vs parseFloat()
roundDecimal() with Math.pow vs. Unary and toPrecision()
Multiply using Decimal.js vs Multiply using native numbers vs exactMath
Multiply using Decimal.js vs Multiply using native numbers vs exactMath 1
Multiply using Decimal.js vs Big
Comments
Confirm delete:
Do you really want to delete benchmark?