Javascript Decimals are Broken?

Опубликовано: 04 Март 2026
на канале: Dev Leonardo
786
16

On javascript 0.1+0.2 is 0.30000000000000004

Sure, why not! Well.. it's floating point math :)

Computers can only natively store integers, so they need some way of representing decimal numbers. This representation is not perfectly accurate. This is why, more often than not, 0.1 + 0.2 != 0.3.

You can learn more here: https://0.30000000000000004.com/

_______________________________
Hit like and subscribe for more content! :D
Join the Discord community! Here's the invite:   / discord  

You can also follow me on the other platforms:
Twitter:   / balastrong  
dev.to: https://dev.to/balastrong
Home: https://leonardomontini.dev/
TikTok:   / balastrong  
GitHub: https://github.com/Balastrong
Instagram:   / devbalastrong  

#javascript #js #programming