Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
toFixed vs toPrecision vs Math.round() vs Math.Floor
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Browser:
Firefox 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
toFixed(6)
23949510.0 Ops/sec
toPrecision(6).toString()
18116802.0 Ops/sec
(Math.round(*1000000)/1000000)
1782905216.0 Ops/sec
Math.floor( * 1000000)
1775076096.0 Ops/sec
Script Preparation code:
var someFloat = 0.123456789;
Tests:
toFixed(6)
someFloat.toFixed(6);
toPrecision(6).toString()
someFloat.toPrecision(6);
(Math.round(*1000000)/1000000)
(Math.round(someFloat*1000000)/1000000);
Math.floor( * 1000000)
Math.floor(someFloat * 1000000);