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. |
[edit] Explanation
"e" is a mathematical constant that is about equal to 2.71828182846. π is about equal to 3.14159265359.
Computers use "floating point" numbers to store decimals. As noted in the comic, e^π - π is 19.999099979. However, Black Hat'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). A much later comic, Approximations, takes this to the next level.
[edit] 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.
