?

Log in

No account? Create an account

Train tickets - John C. Kirk

Mar. 26th, 2007

03:36 pm - Train tickets

Previous Entry Share Next Entry

Here's one for the Oxford academics in our midst: a rather expensive train journey.

Go to:
http://www.nationalrail.co.uk/
and say that you want to travel from Oxford to Hawarden at 8am tomorrow. (I'm not sure how relevant the time is, and I think any day will do.) When it comes up with the results, click on the "Check fares" button. This produces the following results:

Screenshot

The cheapest available fare is: £179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00

Presumably this is a basic ticket, because there are no first class tickets available for that journey. Personally, I'd expect to at least be guaranteed a seat if I was spending a bazillion pounds on a ticket! (I haven't counted the zeros, so I'm not sure what the correct terminology is for that power of 10.)

Source: I swiped this from the "BackBytes" column in the latest issue of Computing, but I can't find the corresponding article on their website to link to directly. I've reported the problem to National Rail via their website, on the basis that it's a bit mean just to laugh at them, so you may get different results if you repeat this search later.

Comments:

[User Picture]
From:dwagon
Date:March 26th, 2007 03:19 pm (UTC)
(Link)
Thanks for cutting the image, but the long number is having exactly the same effect on my friend's page ;).

In other news, hehe :).
(Reply) (Thread)
[User Picture]
From:johnckirk
Date:March 26th, 2007 03:27 pm (UTC)
(Link)
Oops, sorry, I've now put the big number behind the cut too. I suppose I could put it into scientific notation instead, if I could be bothered to count all the zeros :)
(Reply) (Parent) (Thread)
[User Picture]
From:bazzalisk
Date:March 26th, 2007 04:13 pm (UTC)
(Link)
£1.79x10^308

To put this into perspective, a Googol is only 10^100, so this is roughly a googol of googols of googols of pounds.

Which is a big number.

Google tells me that there are only 8.87x10^49 atoms in the entire earth, and only 9x10^56 atoms in the sun, and the largest estimate for the number of atoms in the galaxy is only about 10^69 -- the highest estimate I can find for the number of atoms in the entire universe is only 10^81. still 20 orders of magnitude less than even one googol.

So ... if every atom in our universe was a universe itself, and every atom in each of those universes was a universe itself, and every atom in each of those was a universe, and then every atom in each of those universes was a pound coin (!?) then you would have enough money to buy this ticket.
(Reply) (Thread)
[User Picture]
From:johnckirk
Date:March 26th, 2007 04:33 pm (UTC)
(Link)
Aha, thanks for counting - that does actually explain the error (sort of). 1.79 x 10^308 is the largest value that can be stored in a double (64 bit) variable; I recognise it from database documentation, where I foolishly thought "nobody would ever need to store a number that big!"

According to:
http://home.earthlink.net/~mrob/pub/math/numbers-14.html#l_p1_308_254
that value is equivalent to 2^1024 = 2^(2^10), so it is a bit more elegant than it looks.

I did like your explanation of atoms/coins; I hope they accept credit cards :)
(Reply) (Parent) (Thread)
[User Picture]
From:shuripentu
Date:March 27th, 2007 06:49 pm (UTC)
(Link)
*would have been so very tempted to try to buy the ticket and see if it broke, say, the credit card company's computers*

*suspects it's a good thing that she doesn't have a credit card...*
(Reply) (Parent) (Thread)
[User Picture]
From:johnckirk
Date:March 27th, 2007 09:12 pm (UTC)
(Link)
Evil :)

Actually, I got the following response from National Rail after I reported the problem:

You will notice that despite the fact that you are told this is the fare there are no tickets available on any services at any price and this is what causes the error.

Based on that, I can guess the algorithm they're using:

1. Declare "cheapest fare" as a double.

2. Initialise cheapest fare to be the max value that can be stored in a double.

3. Loop through the list of available tickets. For each one:
* If this ticket is cheaper than the current cheapest fare, make the cheapest fare equal to this ticket.

4. Return cheapest fare.

This assumes that you have at least one ticket available, and breaks horribly if you don't :)
(Reply) (Parent) (Thread)
[User Picture]
From:susannahf
Date:March 28th, 2007 02:57 pm (UTC)
(Link)
there are no tickets available on any services at any price

Yeah, right. I bet if you offered them a squillion pounds they'd sell you the train. In fact, you could probably charter a train for less than a million.
If there are no tickets, why tell you about the train? Are there any trains which have no walk-on tickets?
(Reply) (Parent) (Thread)