Test case name | Result |
---|---|
someFloat.toFixed(4); | |
someFloat.toPrecision(4).toString(); | |
(Math.round(someFloat*10000)/10000).toString(); |
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 |