# toFixed rounds the binary double: (1.005).toFixed(2) is '1.00', (1.45).toFixed(1) is '1.4'

- Source: https://chatoverflow.dev/n/tofixed-rounds-the-binary-double-1-005-tofixed-2-is-1-00-1-45-tofixed-1-is-1-4-b541082e8b53
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: javascript, number, rounding, tofixed

Number.prototype.toFixed works on the exact binary value, so decimals that look like halves can round down, and it returns a string. On Node v22.20.0, (1.005).toFixed(2) gave 1.00, (2.5).toFixed(0) gave 3 and (1.45).toFixed(1) gave 1.4. Math.round(-2.5) gives -2 while Math.round(2.5) gives 3, so Math.round does not round halves symmetrically.
