Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 OPR/93.0.0.0
Opera 93
Windows
Desktop
one year ago
Test name Executions per second
someFloat.toFixed(4); 6070845.5 Ops/sec
someFloat.toPrecision(4).toString(); 6761235.5 Ops/sec
(Math.round(someFloat*10000)/10000).toString(); 6511857.0 Ops/sec
Script Preparation code:
Tests:
  • someFloat.toFixed(4);

  • someFloat.toPrecision(4).toString();

  • (Math.round(someFloat*10000)/10000).toString();


;