Thursday, January 1, 2009

some anti-microsoft humor

"There are multiple reports springing up all over the internet of a mass suicide of Microsoft 30GB Zune players globally..." [slashdot]. I read on msnbc (remembering that ms stands for microsoft) that the bug was related to '08 being a leap year, which seemed kind of crazy. According to this site, the code containing the bug was the following:

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}
which just seems like the most retarded piece of code ever. If it were me, I would have just used / and * or / and % even, but perhaps they were worried that that would be slower because it is maybe repeating some of the computation [I just tested this (I am bored -- everyone is sleeping but me), and the while -=, += method is over twice as slow as the /, * method]. So, way to go Microsoft.

No comments: