Fork me on GitHub

Everything you never wanted to know about JavaScript numbers

Bartek Szopka(00:26:45) Binoculars Image

sourced from JSConfEU


All the ECMAScript standard says about Numbers in JavaScript is that they are represented by "the double-precision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic" and, while understanding the binary representation of JavaScript numbers is not necessary in your day-to-day programming, it's really worth digging into as it opens up the brave new world of questions you never thought you could ask (why is 0.1 not exactly what it is? how does Infinity look like? is there more than one zero? why the hell it's called floating point?) and, more importantly, allows us to find answers to them.