Test name | Executions per second |
---|---|
Intl.NumberFormat | 72855.7 Ops/sec |
Manually calculate | 6004531.5 Ops/sec |
var a = new Intl.NumberFormat([], {minimumFractionDigits: 2, useGrouping: false}).format(1234567.89);
var z = Number(a);
const a = 1234567.89;
const t = Math.pow(10, 2 ?? 0);
const z = Math.min(
Math.floor(a * t) /
t,
100
);