Comment by wodenokoto
4 years ago
I was kinda hoping for a visualization of which numbers exists in floating point.
While I always new about
0.1 + 0.2 -> 0.30000000000000004
it was still kind of an epiphany realizing that floating point numbers don’t so much have rounding errors as they are simply discreet numbers.
You can move from one float to the next, which is a meaningfull operation on discreet numbers like integers, but not continuous numbers like rational and irrational numbers.
I also feel like that is a much more important take away from a user of floating points knowing what the mantissa is.
I highly recommend watching this video, which explains floats in the context of Mario 64: https://www.youtube.com/watch?v=9hdFG2GcNuA
Games are a great way to explain floats because they're so visual. Specifically, check out 3:31, where the game has been hacked so that the possible float values in one of the movement directions is quite coarse.
(If you're curious what a PU is, and would like some completely useless knowledge, this video is also an absolute classic and very entertaining: https://www.youtube.com/watch?v=kpk2tdsPh0A)
> You can move from one float to the next, which is a meaningfull operation on discreet numbers like integers, but not continuous numbers like rational and irrational numbers.
What do you mean by continuous? Obviously if you take a number line and remove either the rational or irrational numbers, you will end up with infinitely many holes.
The thing that makes floating point numbers unique is that, for any given representation, there are actually only finitely many. There’s a largest possible value and a smallest possible value and each number will have gaps on either side of it. I think you meant that the rationals and irrationals are dense (for any two distinct numbers, you can find another number between them), which is also false for floating-point numbers.
> What do you mean by continuous?
I meant continuous in the “mathematical sense”. But maybe continuous is actually statistical term, and dense is the correct mathematical term.
I dunno, I feel it better to consider floats to not be a single discrete number but an interval.