Google

Home
Most Popular
Petals

|
*
2007/10/10
 23:00:06

How (not) to calculate Pi

I stumbled on 31415926535.com, and the first thing I notice is a script called calcPi.js. Curious as to which values were used to calculate π, as the name implies calculation and not a lookup, I investigated further. Turns out it's a list of a lot of numbers, which isn't so unusual. The interesting part is what happens when it goes to pull the next value once the lookup table is exceeded. Rather than finishing or making a call to the server for more data, it simply runs Math.floor(Math.random()*10);. Makes me wonder how much of the included sequence is accurate.

Of course the randomly selecting (and highlighting) "secret" indexes is rather odd too.

#
By babada on 2007/10/11 at 12:06:13

Ha, that is hilarious!