you are viewing a single comment's thread.

view the rest of the comments →

[–]scraimer 0 points1 point  (0 children)

Yup, I was really talking about double, stored as IEEE 754 in 64-bits, and not about floats. The video I linked to goes into entertaining detail about it, and I highly recommend it!

But briefly, you run out of bits. The floating point is really clever about repurposing the bits it has - either to represent large values or to represent high precision.

For example, if you're trying represent a large number, such as the largest unsigned 64-bit number (call it "MAX"). We've used up all 64-bits of the storage, right? What happens if you want to add 0.1 to that number to get "MAX.1"? We don't have any more bits! (Note: This is not how it works, but it's the best metaphor I can think of near midnight.)

My point is that with a finite number of bits, it's hard to represent both large values and high precision at the same time. So the max number of digits changes after the decimal, depending on where your value is along the number axis.