read the transcript!
science <3 floating point
floating point was invented to do scientific computation
- weather simulations!
- earthquake modeling!
- orbital mechanics!
scientists don’t need unlimited precision…
we only know an electron’s mass to 9 decimal places anyway…
9 decimal places is already VERY precise!
but they do need TINY numbers and GIANT numbers
mass of hydrogen atom:
1.6735575 * 10^-24 grams
distance to Andromeda galaxy:
2.4 * 10^22 meters
floating point is inspired by scientific notation
1.6735575 x 10^-24
The idea in floating point is to store a number by splitting it into:
- the exponent (like
- the multiplier (like
- and its sign (+ or -)
floating point isn’t just used for science though
Similarly, numbers in JSON are often interpreted as floating point numbers.
people usually explain floating point as “it’s scientific notation, but in binary!” That’s true, but I’ve never found it intuitive so we’re going to explain it a different way.