217: e to the pi Minus pi
|e to the pi Minus pi|
Title text: Also, I hear the 4th root of (9^2 + 19^2/22) is pi.
e is a mathematical constant that is an irrational number roughly equal to 2.71828182846. π is another irrational number roughly equal to 3.14159265359. An important feature of irrational numbers is that their decimal forms neither terminate nor repeat.
But computers use floating point numbers to store decimals, and with only a finite amount of data for a given number, they can never represent e, π, or eπ - π exactly. (It is nontrivial that eπ - π is irrational. It was proven by Yuri Valentinovich Nesterenko in the late 20th century.) As noted in the comic, eπ - π is about 19.999099979. However, Black Hat's teammates didn't know enough about mathematics and let Black Hat trick them into believing that eπ - π = 20, exactly. Therefore they thought their algorithm had a slight programming error.
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 π (≈3.1415926535). A much later comic, 1047: Approximations, puts forth quite a few more mathematical coincidences.
- 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.