Shostack + Friends Blog Archive

 

Amusements with Alpha

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.

5 comments on "Amusements with Alpha"

  • AnonYmous says:

    try:
    * “what is the meaning of life?”
    * “how much wood would a woodchuck chuck if a woodchuck could chuck wood?”
    * “are you skynet?”

  • Chris says:

    “Everything I say is a lie. Discuss.”

  • CP says:

    Can’t wait until the programmers have to get all geared up for Y10K. I wonder if they will look back in the history books and say Y2K wasn’t so bad…

  • Eric Goldman says:

    Been trying to break it with some rediculous requests, but usually it will just not execute odd things, I would this one to be interesting though:
    sqrt(-3) usd = ? euros

  • sqrt says:

    * ninjas vs. pirates
    Wolfram/Alpha used to show information for two movies…now the response makes more sense…

Comments are closed.