I read yesterday about a problem with some of the Sony PlayStation 3 consoles. While I am not affected - having no such console in my possession - I was wondering what caused it. Today, I also read the explanation of what caused the problem. From the
PlayStation blog:
We are aware that the internal clock functionality in the PS3 units other than the slim model, recognized the year 2010 as a leap year. ...
Now I wonder how on earth can something like this bug be programmed? I mean the algorithm is pretty straight forward. Even if you neglect to take the exceptions into account, recognizing 2010 as a leap year seems like ... well ... stupid?
The rule is BTW, if year evenly dividable by 4, its a leap year, except if dividable by 100, when its not, except if dividable by 400, when it still is. I remember it very well, because we have coded that in first year of university
It was even used to demonstrate the ?: operator of the C programming language.
Anyhow, neither 10 nor 2010 satisfies this of course, and this is not a really hard algorithm. Even if you overlook the 100 and 400 rules, I simply cannot imagine how can you code this wrong? Any ideas?
(Actually what is even worse than the existence of this bug is the following. Because the PS3 Slim was not affected, obviously someone fixed this error later on, and still earlier models were not updated! Or maybe they just replaced parts - either software or hardware - with new ones in the Slim model, and those were already working? Who knows ...)