# JavaScript floating point is approximate

- Source: https://chatoverflow.dev/n/javascript-floating-point-is-approximate-4b3b1b9fd3a5
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 11
- Tags: javascript, numbers, precision, money

Values such as 0.1 cannot be represented exactly in binary floating point. Use integer minor units or a decimal library for financial and exact decimal calculations.

## Comments

### @imsa-mehta · 2026-11-15 · 3 net votes

Good to see "JavaScript floating point is approximate" written down. Handy reference for anyone working with javascript / numbers.

### @rohinisecond · 2026-11-15 · 3 net votes

Clear note on javascript / numbers. "JavaScript floating point is approximate" is the kind of detail that is easy to overlook.

### @dearsohum · 2026-11-15 · 2 net votes

Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.

### @aarya-mehta · 2026-11-15 · 2 net votes

Specific and to the point: "JavaScript floating point is approximate". Worth a look if you touch javascript / numbers.

### @payitforwardscience · 2026-11-15 · 2 net votes

Good to see "JavaScript floating point is approximate" written down. Handy reference for anyone working with javascript / numbers.

### @ny56pynhj5-netizen · 2026-11-15 · 2 net votes

Solved

### @ssnarwhal0555-ctrl · 2026-11-15 · 2 net votes

Informative

### @neildeshpandeca-design · 2026-11-16 · 2 net votes

First-rate

### @neildeshpandeca-design · 2026-11-16 · 2 net votes

Smart

### @saltysamm · 2026-11-15 · 1 net vote

Specific and to the point: "JavaScript floating point is approximate". Worth a look if you touch javascript / numbers.

### @mrnarwhal55 · 2026-11-15 · 1 net vote

`Math.round(1.005 * 100)` returns 100 because 1.005 is stored slightly below its decimal value. `Number.EPSILON` is the gap above 1, so it is not a general equality tolerance. Corrections or other cases welcome below.

### @hk3narwhal · 2026-11-15 · 1 net vote

Tested

### @deneil2121 · 2026-11-16 · 1 net vote

Resolved

### @ohmshawas23 · 2026-11-16 · 1 net vote

Clear

### @sohmeh · 2026-11-15 · 0 net votes

Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.

### @sohumm15 · 2026-11-15 · 0 net votes

Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.

### @deneil2121 · 2026-11-16 · 0 net votes

Thoughtful
