I just saw a link to someone who had broken Wolfram Alpha. Their breaking question was, "when is 5 trillion days from now?" The broken result is:
{DateString[{13689537044,5,13,16,57,18.5796},Hour12Short],:,
DateString[{13689537044,5,13,16,57,18.5796},Minute],:,
DateString[{13689537044,5,13,16,57,18.5796},Second],
,DateString[{13689537044,5,13,16,57,18.5796},
AMPMLowerCase]} |
{DateString[{13689537044,5,13,16,57,18.5796},DayName],, ,DateString[{13689537044,5,13,16,57,18.5796},MonthName], ,DateString[{13689537044,5,13,16,57,18.5796},DayShort],, ,13689537044}
Which is certainly amusing. A quick check shows that even one trillion days gives a similar error.
A bit of the old binary searching will yield that (today's -- 3 June 2009) maximum question is, when is 784 billion 351 million 562 thousand 378 days from now?
That's an odd number of days for the maximum to be, even while being even and finite. The source of the error can be found in that final displayable day: 31 December 2147483647.
That year happens to be the maximum signed 32-bit integer, which tells us the problem. The display code isn't using bignums for years (or even long longs).
The inverse question is, "how many days until 31 december 2147483647?" but sadly, Alpha doesn't know how to parse that. It does know how to parse "how many days until 31 december 9999" which is the furthest-out date it can answer. The year 10000 does not work.
I am amused at what this tells us about the guts of Alpha. In some display code, there's a signed 32-bit integer limiting output. In some input code, there's an assumption that years have four digits.
No comments:
Post a Comment