Flavio Copes
Read post

How to fix decimals arithmetic in JavaScript

If you try to do the sum of two decimal numbers in JavaScript you might have a surprise. The reason is due to the fact computers store data as binary, 0 or 1. Not every decimal number can be represented perfectly in this binary format. Some numbers are repeating numbers in binary. Try to convert 0.1 from decimal to binary.

    #javascript
Apr 25, 2022•2m read time•From flaviocopes.com
Post cover image
1 Impression1 Comment
Flavio Copes's image
Flavio Copes

202 Followers

•

1.1K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard