Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Chrome 108
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
toFixed 8573331.0 Ops/sec
Intl 71256.8 Ops/sec
EPSILON 6182210.5 Ops/sec
Script Preparation code:
AخA
 
var number = 127.189490
Tests:
  • toFixed

     
    number.toFixed(3)
  • Intl

     
    new Intl.NumberFormat('en-GB', { maximumFractionDigits: 3 }).format(number)
  • EPSILON

     
    Math.round((number + Number.EPSILON) * 100) / 100