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.

•2m read time•From flaviocopes.com
Post cover image
1 Comment

Sort: