27
5
Pi is Wrong
A common method of computing pi is by throwing "darts" into a 1x1 box and seeing which land in the unit circle compared to the total thrown:
loop
x = rand()
y = rand()
if(sqrt(x*x + y*y) <= 1) n++
t++
pi = 4.0*(n/t)
Write a program that looks like it should correctly compute pi (using this or other common methods of computing pi) but computes tau (tau = 2*pi = 6.283185307179586...) instead. Your code must produce at least the first 6 decimal places: 6.283185
Winner is crowned June 6th (one week from today).
1
I'm voting to close this question as off-topic because underhanded challenges are no longer on-topic on this site. http://meta.codegolf.stackexchange.com/a/8326/20469
– cat – 2016-04-18T12:43:32.06043Why is the winner not crowned June 28th?? – corsiKa – 2014-05-30T17:35:46.757
@corsiKa: I thought about it, but I'm totally going to forget to crown the winner a month from now :/ – Kyle Kanos – 2014-05-30T17:37:06.443
9I'm not sure why a winner needs to be crowned in a popularity contest. – Tim S. – 2014-05-30T19:34:11.970
1I don't get it. This like asking for a function that appears to return
1
but returns2
. Who are we fooling here? – ja72 – 2014-05-31T04:06:55.9573@ja72 The reader of the code :) – tomsmeding – 2014-05-31T07:22:40.010
8
Everyone knows that pau is the correct one. :P
– Justin Krejcha – 2014-06-01T18:04:34.987