217: e to the pi Minus pi

Explain xkcd: It's 'cause you're dumb.
Revision as of 08:39, 30 October 2012 by Bpothier (Talk | contribs)

Jump to: navigation, search
e to the pi Minus pi
Also, I hear the 4th root of (9^2 + 19^2/22) is pi.
Title text: Also, I hear the 4th root of (9^2 + 19^2/22) is pi.

Explanation

Computers use "floating point" numbers to store decimals. As noted in the comic, e^pi - pi is 19.999099979. However, Hat Guy's teammates' algorithms truncate to 3 decimal digits — giving a result of 19.999. Yet the programmers thought that 19.999 should come out to 20 unless they had errors in their algorithms (they did not; 19.999 would be the correct result). ACM is the Association for Computing Machinery; it sponsors the International Collegiate Programming Contest.

In the title text, another mathematical coincidence is presented. The 4th root of (9^2 + 19^2/22) is 3.1415926525, which is extremely close to pi (≈3.1415926535).

Transcript

Cueball: Hey, check it out: e^pi-pi is 19.999099979. That's weird.
Black Hat: Yeah. That's how I got kicked out of the ACM in college.
Cueball: . . . what?
Black Hat: During a competition, I told the programmers on our team that e^pi-pi was a standard test of floating-point handlers--it would come out to 20 unless they had rounding errors.
Cueball: That's awful.
Black Hat: Yeah, they dug through half their algorithms looking for the bug before they figured it out.
comment.png add a comment!

Discussion

Asserting that the programmers' algorithms truncated to three decimal digits is an unsupported and unnecessary extrapolation. Most floating-point implementations use binary, not decimal, and 19.999099979 looks very much like a rounding error in binary floating-point that has accumulated over several operations. Daddy (talk) 12:39, 29 April 2013 (UTC)

Fixed. Xhfz (talk) 22:57, 16 August 2013 (UTC)

The third bullet-point above needs changing... (9^2+(19^2/22))=97.4090909091 which is close to pi to the fourth power, so it should be (as noted in the text) (9^2+(19^2/22))^1/4 Squirreltape (talk) 19:27, 25 February 2014 (UTC)

Actually, in-case you didn't notice, it says "∜(9² + 19²/22)", not just the sum on its own. I checked the sum on my calculator, and it is equal to what the page is saying. "∜(9² + 19²/22)" means "4th root of (9^2+19^2/22)" (What the title text is saying), or on Windows Calculator, "(9^2+19^2/22) yroot(4)" (Basically what the sum is saying). So, the 3rd bullet point is correct. --Katavschi (talk) 22:48, 23 April 2014 (UTC)
It says above that (π + 20)^i ≈ -i, but this should be (π + 20)^i ≈ -1. Proof: π + 20 ≈ e^π => (π + 20)^i ≈ (e^π)^i = e^(πi) = -1.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox

It seems you are using noscript, which is stopping our project wonderful ads from working. Explain xkcd uses ads to pay for bandwidth, and we manually approve all our advertisers, and our ads are restricted to unobtrusive images and slow animated GIFs. If you found this site helpful, please consider whitelisting us.

Want to advertise with us, or donate to us with Paypal or Bitcoin?