What follows is a sex joke about floating point numbers.
Irrational numbers are ones that may not terminate, or may repeat forever. For example, the number pi is irrational (because it neither terminates nor repeats), and so is the decimal representation of 5/9=0.555555... (because it repeats forever).
There is a problem. How do you represent an irrational number digitally? You have only a limited number of bits... and possibly an infinite number of digits to encode.
What makes it happen are the guard, round, and sticky bits. The guard bit is the first bit that not fit into the representation. The round bit is the second bit that does not fit the representation. Finally, the sticky bit is a bitwise-OR of all the bits after the round bit.
OK, here's the joke. It's kind of a stretch, but stay with me...
Rounding is like sex.
You gotta use the guard bit.
If you don't, you get the sticky bit.
And then... well, you're round.
*slow clap*
ReplyDelete