Title text:
It has been −2,147,483,648 days since our last integer overflow.
Transcript:
Transcript will show once it’s been added to explainxkcd.com
Source: https://xkcd.com/3228/
Floating point errors are what eventually convinced God to make the universe the way it is. The initial plan was to have all properties be continuous, but that resulted in many floating point errors. That’s when he said: fuck it, quantum states are discrete.
why is it a negative number for the floating point error one? Doesn’t a day counter either increments or be set to zero? are they minusing the day by the value it holds to make it zero instead of just assigning it zero?? Why??
At a guess, the counter goes up by fractions of a day internally, but it’s reset by subtracting the integer part, rounded.
The original version wouldn’t have had the rounding but they “fixed” that after the first time they did a reset and it went to 1 not 0.
As to why they wouldn’t just set it to zero, well here we have the joke under a microscope and it’s struggling to stay alive. Put the scalpel down.
… they were just about to experience a floating point error when the sign was put up.
They’re using a signed 32-bit integer which can overflow to negative numbers. An unsigned integer would roll over to just 0, but then the joke wouldn’t work.
Edit: I misread the question and was thinking about the title text
This one hits deep. One of my first more complicated projects was a driver for a device that counted a lot of values. Imagine an energy meter.
At the beginning I thought about writing code to create my own type since I was limited to uint32 as the biggest on board type. To spare some work I quickly decided to use a float type for the first time without thinking much about it (I usually use fixed point integers for everyday work)
Way into the project I thought about what happens, when the actual value is gigantic and I try to add a very small number. After thinking about it I realized that nothing happens. So my counter would stop working. I changed everything and never used a floating point number again in my life I 🤣


