toFixed(6) vs toPrecision(6).toString() vs (Math.round(*1000000)/1000000) vs Math.floor( * 1000000)| Test case name | Result |
|---|---|
| toFixed(6) | |
| toPrecision(6).toString() | |
| (Math.round(*1000000)/1000000) | |
| Math.floor( * 1000000) |
| Test name | Executions per second |
|---|---|
| ✓ (Math.round(*1000000)/1000000) | 1,782,905,216 Ops/sec |
| Math.floor( * 1000000) | 1,775,076,096 Ops/sec |
| toFixed(6) | 23,949,510 Ops/sec |
| toPrecision(6).toString() | 18,116,802 Ops/sec |